facets 2.6.0 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.rdoc +331 -35
- data/MANIFEST +685 -826
- data/{doc/guide/notes.rd → NOTES} +0 -0
- data/README.rdoc +73 -25
- data/Rakefile +245 -2
- data/TODO +5 -0
- data/demo/hook.rd +47 -0
- data/demo/scenario_require.rd +9 -0
- data/doc/README.more +24 -6
- data/doc/manual/about.rb +47 -0
- data/doc/manual/annotations.rdoc +60 -0
- data/doc/manual/associations.rdoc +55 -0
- data/doc/manual/blockups.rdoc +101 -0
- data/doc/manual/capsule.rdoc +34 -0
- data/doc/manual/command.rdoc +177 -0
- data/doc/manual/core.rdoc +37 -0
- data/doc/manual/faq.rdoc +32 -0
- data/doc/manual/typecast.html +112 -0
- data/lib/core/facets.rb +359 -11
- data/lib/core/facets/array/combination.rb +3 -3
- data/lib/core/facets/array/index.rb +4 -1
- data/lib/core/facets/array/permutation.rb +2 -2
- data/lib/core/facets/array/product.rb +1 -1
- data/lib/core/facets/binding/eval.rb +1 -1
- data/lib/core/facets/denumerable.rb +76 -0
- data/lib/core/facets/duplicable.rb +34 -0
- data/lib/core/facets/enumerable/count.rb +10 -4
- data/lib/core/facets/enumerable/defer.rb +77 -0
- data/lib/core/facets/enumerable/each_by.rb +1 -1
- data/lib/core/facets/enumerable/every.rb +35 -0
- data/lib/{more/facets/elementwise.rb → core/facets/enumerable/ewise.rb} +0 -0
- data/lib/core/facets/enumerable/filter.rb +25 -0
- data/lib/core/facets/enumerable/group_by.rb +1 -1
- data/lib/core/facets/enumerable/none.rb +3 -2
- data/lib/core/facets/enumerable/one.rb +3 -2
- data/lib/core/facets/enumerable/per.rb +61 -0
- data/lib/core/facets/exception/raised.rb +14 -0
- data/lib/core/facets/integer/odd.rb +5 -1
- data/lib/core/facets/kernel/__dir__.rb +13 -3
- data/lib/core/facets/kernel/__here__.rb +14 -0
- data/lib/core/facets/kernel/__method__.rb +9 -3
- data/lib/core/facets/kernel/ask.rb +1 -0
- data/lib/core/facets/kernel/equate.rb +13 -0
- data/lib/core/facets/kernel/extension.rb +9 -0
- data/lib/core/facets/kernel/identical.rb +4 -0
- data/lib/core/facets/kernel/instance_exec.rb +2 -1
- data/lib/core/facets/kernel/method.rb +49 -0
- data/lib/core/facets/kernel/object_send.rb +2 -2
- data/lib/core/facets/kernel/{state.rb → object_state.rb} +23 -12
- data/lib/core/facets/kernel/require_all.rb +6 -1
- data/lib/core/facets/kernel/require_local.rb +8 -1
- data/lib/core/facets/kernel/require_relative.rb +52 -0
- data/lib/core/facets/kernel/source_location.rb +13 -0
- data/lib/core/facets/kernel/tap.rb +13 -6
- data/lib/core/facets/module/attr_setter.rb +57 -0
- data/lib/core/facets/module/instance_method.rb +24 -0
- data/lib/core/facets/module/module_load.rb +60 -44
- data/lib/core/facets/module/module_require.rb +1 -0
- data/lib/core/facets/nilclass/to_f.rb +1 -1
- data/lib/core/facets/objectspace/op_fetch.rb +3 -0
- data/lib/core/facets/proc/curry.rb +4 -3
- data/lib/core/facets/string/bytes.rb +10 -4
- data/lib/core/facets/string/camelcase.rb +6 -5
- data/lib/core/facets/string/chars.rb +5 -1
- data/lib/core/facets/string/each_char.rb +1 -1
- data/lib/core/facets/string/each_word.rb +1 -1
- data/lib/core/facets/string/lines.rb +11 -4
- data/lib/core/facets/string/start_with.rb +9 -2
- data/lib/core/facets/string/unfold.rb +27 -0
- data/lib/core/facets/symbol/succ.rb +3 -3
- data/lib/core/facets/symbol/thrown.rb +20 -0
- data/lib/core/facets/symbol/to_proc.rb +3 -2
- data/lib/core/facets/time/to_time.rb +1 -1
- data/lib/core/facets/to_hash.rb +41 -100
- data/lib/core/facets/unboundmethod/name.rb +20 -23
- data/lib/more/facets/ansicode.rb +1 -10
- data/lib/more/facets/autoarray.rb +3 -31
- data/lib/more/facets/basicobject.rb +73 -0
- data/lib/more/facets/blankslate.rb +2 -66
- data/lib/{lore → more}/facets/cgi.rb +0 -0
- data/lib/more/facets/class_extend.rb +1 -0
- data/lib/{lore → more}/facets/continuation.rb +0 -0
- data/lib/{lore → more}/facets/date.rb +3 -3
- data/lib/more/facets/enumargs.rb +192 -0
- data/lib/more/facets/enumerablepass.rb +2 -216
- data/lib/more/facets/enumerator.rb +62 -0
- data/lib/more/facets/{equatable.rb → equitable.rb} +11 -11
- data/lib/more/facets/expirable.rb +13 -41
- data/lib/{lore → more}/facets/fileutils.rb +0 -0
- data/lib/{lore → more}/facets/fileutils/head.rb +0 -0
- data/lib/{lore → more}/facets/fileutils/safe_ln.rb +0 -0
- data/lib/{lore → more}/facets/fileutils/slice.rb +0 -0
- data/lib/{lore → more}/facets/fileutils/tail.rb +0 -0
- data/lib/{lore → more}/facets/fileutils/wc.rb +0 -0
- data/lib/{lore → more}/facets/fileutils/whereis.rb +0 -0
- data/lib/{lore → more}/facets/fileutils/which.rb +0 -0
- data/lib/{lore → more}/facets/getoptlong.rb +0 -0
- data/lib/more/facets/hook.rb +2 -29
- data/lib/more/facets/inheritor.rb +2 -2
- data/lib/more/facets/instance_eval.rb +50 -0
- data/lib/more/facets/instance_function.rb +78 -0
- data/lib/more/facets/main.rb +20 -15
- data/lib/more/facets/memoize.rb +1 -113
- data/lib/more/facets/module/attr.rb +83 -0
- data/lib/more/facets/module/attr_tester.rb +44 -0
- data/lib/more/facets/module/attr_toggler.rb +59 -0
- data/lib/more/facets/module/attr_validator.rb +34 -0
- data/lib/more/facets/{class_extension.rb → module/class_extend.rb} +21 -13
- data/lib/more/facets/once.rb +59 -0
- data/lib/more/facets/openmodule.rb +1 -0
- data/lib/more/facets/orderedhash.rb +1 -33
- data/lib/{lore → more}/facets/ostruct.rb +0 -0
- data/lib/more/facets/ostructable.rb +1 -4
- data/lib/more/facets/partial.rb +18 -16
- data/lib/{lore → more}/facets/pathname.rb +0 -0
- data/lib/more/facets/preinitialize.rb +157 -0
- data/lib/{lore → more}/facets/rbconfig.rb +0 -0
- data/lib/more/facets/recorder.rb +1 -2
- data/lib/{lore → more}/facets/set.rb +0 -0
- data/lib/{lore → more}/facets/shellwords.rb +0 -0
- data/lib/{lore → more}/facets/uri.rb +0 -0
- data/lib/{lore → more}/facets/yaml.rb +0 -0
- data/lib/{lore → more}/facets/zlib.rb +0 -0
- data/meta/loadpath +0 -1
- data/meta/sitemap +4 -0
- data/meta/version +1 -1
- data/test/core/enumerable/test_count.rb +1 -1
- data/test/{more/test_filter.rb → core/enumerable/test_defer.rb} +24 -22
- data/test/{more/test_elementor.rb → core/enumerable/test_every.rb} +2 -15
- data/test/core/enumerable/test_ewise.rb +23 -0
- data/test/core/enumerable/test_per.rb +18 -0
- data/test/core/enumerable/test_take.rb +13 -0
- data/test/core/kernel/test_deepcopy.rb +1 -1
- data/test/{more/test_1stclassmethod.rb → core/kernel/test_method.rb} +2 -7
- data/test/core/kernel/test_tap.rb +1 -1
- data/test/core/proc/test_curry.rb +11 -0
- data/test/core/string/test_bytes.rb +1 -1
- data/test/core/string/test_camelcase.rb +23 -6
- data/test/core/string/test_lines.rb +1 -1
- data/test/core/string/test_unfold.rb +14 -0
- data/test/{more → core}/test_blank.rb +0 -0
- data/test/{more → core}/test_boolean.rb +0 -0
- data/test/{more → core}/test_functor.rb +0 -0
- data/test/{lore → more}/test_basicobject.rb +0 -0
- data/test/more/{test_class_extension.rb → test_class_extend.rb} +6 -6
- data/test/{lore → more}/test_continuation.rb +0 -0
- data/test/{lore → more}/test_date.rb +0 -0
- data/test/more/{test_enumerablepass.rb → test_enumargs.rb} +2 -4
- data/test/more/{test_equatable.rb → test_equitable.rb} +2 -2
- data/test/more/{test_instantise.rb → test_instance_function.rb} +3 -2
- data/test/more/test_memoize.rb +1 -1
- data/test/{lore → more}/test_ostruct.rb +0 -0
- metadata +865 -1016
- data/RELEASE +0 -38
- data/doc/README.lore +0 -51
- data/doc/log/basic_stats/index.html +0 -39
- data/doc/log/changelog.html +0 -648
- data/doc/log/changelog.txt +0 -217
- data/doc/log/stats/index.html +0 -39
- data/doc/log/testlog.txt +0 -278
- data/doc/notes/CHANGES +0 -2529
- data/doc/rdoc/lore/classes/Array.html +0 -176
- data/doc/rdoc/lore/classes/CGI.html +0 -191
- data/doc/rdoc/lore/classes/Config.html +0 -135
- data/doc/rdoc/lore/classes/Continuation.html +0 -113
- data/doc/rdoc/lore/classes/Date.html +0 -631
- data/doc/rdoc/lore/classes/DateTime.html +0 -583
- data/doc/rdoc/lore/classes/Enumerable.html +0 -89
- data/doc/rdoc/lore/classes/Enumerable/Enumerator.html +0 -147
- data/doc/rdoc/lore/classes/File.html +0 -128
- data/doc/rdoc/lore/classes/FileUtils.html +0 -434
- data/doc/rdoc/lore/classes/GetoptLong.html +0 -118
- data/doc/rdoc/lore/classes/GetoptLong/DSL.html +0 -208
- data/doc/rdoc/lore/classes/Kernel.html +0 -135
- data/doc/rdoc/lore/classes/Logger.html +0 -229
- data/doc/rdoc/lore/classes/Logger/Ansicolor.html +0 -277
- data/doc/rdoc/lore/classes/Logger/LogDevice.html +0 -121
- data/doc/rdoc/lore/classes/NilClass.html +0 -119
- data/doc/rdoc/lore/classes/OpenStruct.html +0 -432
- data/doc/rdoc/lore/classes/Pathname.html +0 -353
- data/doc/rdoc/lore/classes/Set.html +0 -117
- data/doc/rdoc/lore/classes/Shellwords.html +0 -111
- data/doc/rdoc/lore/classes/String.html +0 -140
- data/doc/rdoc/lore/classes/Time.html +0 -154
- data/doc/rdoc/lore/classes/URI.html +0 -454
- data/doc/rdoc/lore/classes/URI/Hash.html +0 -105
- data/doc/rdoc/lore/classes/URI/Kernel.html +0 -122
- data/doc/rdoc/lore/classes/Zlib.html +0 -188
- data/doc/rdoc/lore/created.rid +0 -1
- data/doc/rdoc/lore/files/README.html +0 -286
- data/doc/rdoc/lore/files/doc/README_lore.html +0 -155
- data/doc/rdoc/lore/files/lib/lore/facets/basicobject_rb.html +0 -118
- data/doc/rdoc/lore/files/lib/lore/facets/cgi_rb.html +0 -111
- data/doc/rdoc/lore/files/lib/lore/facets/continuation_rb.html +0 -147
- data/doc/rdoc/lore/files/lib/lore/facets/date_rb.html +0 -97
- data/doc/rdoc/lore/files/lib/lore/facets/enumerator_rb.html +0 -111
- data/doc/rdoc/lore/files/lib/lore/facets/fileutils/head_rb.html +0 -96
- data/doc/rdoc/lore/files/lib/lore/facets/fileutils/safe_ln_rb.html +0 -96
- data/doc/rdoc/lore/files/lib/lore/facets/fileutils/slice_rb.html +0 -96
- data/doc/rdoc/lore/files/lib/lore/facets/fileutils/tail_rb.html +0 -96
- data/doc/rdoc/lore/files/lib/lore/facets/fileutils/wc_rb.html +0 -96
- data/doc/rdoc/lore/files/lib/lore/facets/fileutils/whereis_rb.html +0 -96
- data/doc/rdoc/lore/files/lib/lore/facets/fileutils/which_rb.html +0 -96
- data/doc/rdoc/lore/files/lib/lore/facets/fileutils_rb.html +0 -131
- data/doc/rdoc/lore/files/lib/lore/facets/getoptlong_rb.html +0 -135
- data/doc/rdoc/lore/files/lib/lore/facets/logger_rb.html +0 -142
- data/doc/rdoc/lore/files/lib/lore/facets/ostruct_rb.html +0 -135
- data/doc/rdoc/lore/files/lib/lore/facets/pathname_rb.html +0 -145
- data/doc/rdoc/lore/files/lib/lore/facets/rbconfig_rb.html +0 -124
- data/doc/rdoc/lore/files/lib/lore/facets/set_rb.html +0 -96
- data/doc/rdoc/lore/files/lib/lore/facets/shellwords_rb.html +0 -124
- data/doc/rdoc/lore/files/lib/lore/facets/uri_rb.html +0 -125
- data/doc/rdoc/lore/files/lib/lore/facets/yaml_rb.html +0 -146
- data/doc/rdoc/lore/files/lib/lore/facets/zlib_rb.html +0 -97
- data/doc/rdoc/lore/fr_class_index.html +0 -73
- data/doc/rdoc/lore/fr_file_index.html +0 -71
- data/doc/rdoc/lore/fr_method_index.html +0 -177
- data/doc/rdoc/lore/index.html +0 -26
- data/doc/rdoc/lore/rdoc-style.css +0 -177
- data/doc/release-notes/RELEASE-2.0.5 +0 -8
- data/doc/release-notes/RELEASE-2.1.0 +0 -9
- data/doc/release-notes/RELEASE-2.1.1 +0 -5
- data/doc/release-notes/RELEASE-2.1.2 +0 -6
- data/doc/release-notes/RELEASE-2.1.3 +0 -5
- data/doc/release-notes/RELEASE-2.2.0 +0 -14
- data/doc/release-notes/RELEASE-2.2.1 +0 -4
- data/doc/release-notes/RELEASE-2.3.0 +0 -6
- data/doc/release-notes/RELEASE-2.4.0 +0 -70
- data/doc/release-notes/RELEASE-2.4.1 +0 -8
- data/doc/release-notes/RELEASE-2.4.2 +0 -4
- data/doc/release-notes/RELEASE-2.4.3 +0 -78
- data/doc/release-notes/RELEASE-2.4.4 +0 -38
- data/doc/release-notes/RELEASE-2.4.5 +0 -37
- data/doc/release-notes/RELEASE-2.5.0 +0 -83
- data/lib/core/facets/kernel/instance.rb +0 -19
- data/lib/lore/facets/basicobject.rb +0 -14
- data/lib/lore/facets/enumerator.rb +0 -67
- data/lib/lore/facets/logger.rb +0 -291
- data/lib/more/facets/1stclassmethod.rb +0 -140
- data/lib/more/facets/advisable.rb +0 -162
- data/lib/more/facets/association.rb +0 -210
- data/lib/more/facets/attr.rb +0 -209
- data/lib/more/facets/basex.rb +0 -37
- data/lib/more/facets/bbcode.rb +0 -397
- data/lib/more/facets/bicrypt.rb +0 -265
- data/lib/more/facets/binreadable.rb +0 -221
- data/lib/more/facets/censor.rb +0 -97
- data/lib/more/facets/classmethods.rb +0 -199
- data/lib/more/facets/consoleutils.rb +0 -99
- data/lib/more/facets/crypt.rb +0 -166
- data/lib/more/facets/dependency.rb +0 -151
- data/lib/more/facets/downloader.rb +0 -281
- data/lib/more/facets/duplicable.rb +0 -43
- data/lib/more/facets/elementor.rb +0 -133
- data/lib/more/facets/filter.rb +0 -121
- data/lib/more/facets/heap.rb +0 -22
- data/lib/more/facets/infinity.rb +0 -193
- data/lib/more/facets/ini.rb +0 -264
- data/lib/more/facets/instantise.rb +0 -1
- data/lib/more/facets/instantize.rb +0 -95
- data/lib/more/facets/interval.rb +0 -282
- data/lib/more/facets/iteration.rb +0 -65
- data/lib/more/facets/linkedlist.rb +0 -222
- data/lib/more/facets/lrucache.rb +0 -157
- data/lib/more/facets/matcher.rb +0 -140
- data/lib/more/facets/memoizer.rb +0 -74
- data/lib/more/facets/minitar.rb +0 -1063
- data/lib/more/facets/nackclass.rb +0 -41
- data/lib/more/facets/net/smtp_tls.rb +0 -131
- data/lib/more/facets/nilstatus.rb +0 -48
- data/lib/more/facets/overload.rb +0 -94
- data/lib/more/facets/paramix.rb +0 -202
- data/lib/more/facets/pool.rb +0 -91
- data/lib/more/facets/pqueue.rb +0 -449
- data/lib/more/facets/pry.rb +0 -32
- data/lib/more/facets/reflection.rb +0 -145
- data/lib/more/facets/semaphore.rb +0 -92
- data/lib/more/facets/settings.rb +0 -248
- data/lib/more/facets/snapshot.rb +0 -209
- data/lib/more/facets/sparse_array.rb +0 -809
- data/lib/more/facets/string/mask.rb +0 -278
- data/lib/more/facets/string/obfuscate.rb +0 -65
- data/lib/more/facets/string/stylize.rb +0 -169
- data/lib/more/facets/string/words.rb +0 -167
- data/lib/more/facets/syncarray.rb +0 -114
- data/lib/more/facets/synchash.rb +0 -157
- data/lib/more/facets/typecast.rb +0 -261
- data/lib/more/facets/uninheritable.rb +0 -50
- data/lib/more/facets/xmlhash.rb +0 -112
- data/lib/more/facets/xoxo.rb +0 -259
- data/lib/more/facets/ziputils.rb +0 -490
- data/task/conflicts +0 -63
- data/task/coverage.rake +0 -37
- data/task/methods +0 -49
- data/task/rdoc.rake +0 -17
- data/task/setup.rake +0 -38
- data/task/test.rake +0 -145
- data/test/more/test_advisable.rb +0 -71
- data/test/more/test_association.rb +0 -38
- data/test/more/test_bbcode.rb +0 -21
- data/test/more/test_binreadable.rb +0 -50
- data/test/more/test_buildable.rb +0 -73
- data/test/more/test_classmethods.rb +0 -56
- data/test/more/test_crypt.rb +0 -32
- data/test/more/test_dependency.rb +0 -69
- data/test/more/test_elementwise.rb +0 -25
- data/test/more/test_infinity.rb +0 -40
- data/test/more/test_interval.rb +0 -151
- data/test/more/test_linkedlist.rb +0 -41
- data/test/more/test_lrucache.rb +0 -14
- data/test/more/test_overload.rb +0 -160
- data/test/more/test_paramix.rb +0 -170
- data/test/more/test_prototype.rb +0 -35
- data/test/more/test_snapshot.rb +0 -21
- data/test/more/test_sparsearray.rb +0 -279
- data/test/more/test_syncarray.rb +0 -15
- data/test/more/test_synchash.rb +0 -16
- data/test/more/test_typecast.rb +0 -54
- data/test/more/test_uninheritable.rb +0 -31
- data/test/more/test_xoxo.rb +0 -274
- data/test/test_facets.rb +0 -9
data/test/more/test_bbcode.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# Test for facets/bbcode.rb
|
2
|
-
|
3
|
-
require 'facets/bbcode.rb'
|
4
|
-
require 'test/unit'
|
5
|
-
|
6
|
-
class TC_BBCode < Test::Unit::TestCase
|
7
|
-
|
8
|
-
def test_to_ansi
|
9
|
-
str = "this is [COLOR=red]red[/COLOR], this is [B]bold[/B]"
|
10
|
-
out = "this is \e[0;31mred\e[0m, this is \e[1mbold\e[0m\n"
|
11
|
-
assert_equal( out, BBCode.bbcode_to_ansi(str) )
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_to_html
|
15
|
-
str = "this is [COLOR=red]red[/COLOR], this is [B]bold[/B]"
|
16
|
-
out = "this is <font color=\"red\">red</font>, this is <strong>bold</strong><br />\n"
|
17
|
-
assert_equal( out, BBCode.bbcode_to_html(str) )
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# Test for facets/binreadable.rb
|
2
|
-
|
3
|
-
require 'facets/binreadable.rb'
|
4
|
-
require 'test/unit'
|
5
|
-
|
6
|
-
class TC_ByteOrder < Test::Unit::TestCase
|
7
|
-
|
8
|
-
include BinaryReader
|
9
|
-
|
10
|
-
def test_equal
|
11
|
-
assert_equal ByteOrder.little?, ByteOrder.little_endian?
|
12
|
-
assert_equal ByteOrder.big?, ByteOrder.big_endian?
|
13
|
-
assert_equal ByteOrder.network?, ByteOrder.big_endian?
|
14
|
-
assert_equal ByteOrder.byte_order, ByteOrder.byteorder
|
15
|
-
|
16
|
-
assert_equal ByteOrder::Big, ByteOrder::BigEndian
|
17
|
-
assert_equal ByteOrder::Network, ByteOrder::BigEndian
|
18
|
-
assert_equal ByteOrder::Little, ByteOrder::LittleEndian
|
19
|
-
|
20
|
-
assert_equal ByteOrder.byte_order, ByteOrder::LittleEndian if ByteOrder.little?
|
21
|
-
assert_equal ByteOrder.byte_order, ByteOrder::BigEndian if ByteOrder.big?
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_uname_byteorder
|
25
|
-
assert_equal(ByteOrder.little?, true) if `uname -m` =~ /i386/
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_byteorder
|
29
|
-
if ByteOrder.little?
|
30
|
-
assert_equal "\x12\x34\x56\x78".unpack("L").first, 0x78563412
|
31
|
-
assert_equal "\x78\x56\x34\x12".unpack("L").first, 0x12345678
|
32
|
-
assert_equal [0x12345678].pack("L"), "\x78\x56\x34\x12"
|
33
|
-
assert_equal [0x78563412].pack("L"), "\x12\x34\x56\x78"
|
34
|
-
else
|
35
|
-
assert_equal "\x12\x34\x56\x78".unpack("L").first, 0x12345678
|
36
|
-
assert_equal "\x78\x56\x34\x12".unpack("L").first, 0x78563412
|
37
|
-
assert_equal [0x12345678].pack("L"), "\x12\x34\x56\x78"
|
38
|
-
assert_equal [0x78563412].pack("L"), "\x78\x56\x34\x12"
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
class TC_BinaryReader < Test::Unit::TestCase
|
45
|
-
|
46
|
-
def test_todo
|
47
|
-
assert(true) # to do
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
data/test/more/test_buildable.rb
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
# Test facets/buildable.rb
|
2
|
-
|
3
|
-
require 'facets/buildable.rb'
|
4
|
-
require 'test/unit'
|
5
|
-
|
6
|
-
class TestBuildable < Test::Unit::TestCase
|
7
|
-
|
8
|
-
module M
|
9
|
-
include Buildable
|
10
|
-
|
11
|
-
extend self
|
12
|
-
|
13
|
-
def m(n,*m) ; "#{n}{#{m}}"; end
|
14
|
-
def t(n) ; "#{n}"; end
|
15
|
-
|
16
|
-
alias :build :m
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_01
|
20
|
-
str = M.build do
|
21
|
-
html do
|
22
|
-
head do
|
23
|
-
title "Test"
|
24
|
-
end
|
25
|
-
body do
|
26
|
-
i "Hello"
|
27
|
-
build! :not
|
28
|
-
t "Test"
|
29
|
-
t "Hey"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
r = "html{head{title{Test}}body{i{Hello}not{}TestHey}}"
|
35
|
-
|
36
|
-
assert_equal( r, M.builder.to_s )
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
#
|
42
|
-
|
43
|
-
class TestBuildingBlock < Test::Unit::TestCase
|
44
|
-
|
45
|
-
module M
|
46
|
-
extend self
|
47
|
-
def m(n,*m) ; "#{n}{#{m}}"; end
|
48
|
-
def t(n) ; "#{n}"; end
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_01
|
52
|
-
build = BuildingBlock.new(M, :m)
|
53
|
-
|
54
|
-
build.html do
|
55
|
-
head do
|
56
|
-
title "Test"
|
57
|
-
end
|
58
|
-
|
59
|
-
body do
|
60
|
-
i "Hello"
|
61
|
-
build! :not
|
62
|
-
t "Test"
|
63
|
-
t "Hey"
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
r = "html{head{title{Test}}body{i{Hello}not{}TestHey}}"
|
68
|
-
|
69
|
-
assert_equal( r, build.to_s )
|
70
|
-
end
|
71
|
-
|
72
|
-
end
|
73
|
-
|
@@ -1,56 +0,0 @@
|
|
1
|
-
# Test facets/classmethods.rb.
|
2
|
-
|
3
|
-
require 'facets/classmethods.rb'
|
4
|
-
require 'test/unit'
|
5
|
-
|
6
|
-
class TC_ClassMethods < Test::Unit::TestCase
|
7
|
-
|
8
|
-
# fixture
|
9
|
-
|
10
|
-
module N
|
11
|
-
class_methods do
|
12
|
-
def n ; 43 ; end
|
13
|
-
def s ; self ; end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
class X
|
18
|
-
include N
|
19
|
-
def n ; 11 ; end
|
20
|
-
end
|
21
|
-
|
22
|
-
module K
|
23
|
-
include N
|
24
|
-
class_methods do
|
25
|
-
def n ; super + 1 ; end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
class Z
|
30
|
-
include K
|
31
|
-
end
|
32
|
-
|
33
|
-
# tests
|
34
|
-
|
35
|
-
def test_knows_self
|
36
|
-
assert_equal( 43, N.n )
|
37
|
-
assert_equal( N, N.s )
|
38
|
-
end
|
39
|
-
def test_included
|
40
|
-
assert_equal( 43, X.n )
|
41
|
-
assert_equal( X, X.s )
|
42
|
-
end
|
43
|
-
def test_instance_level
|
44
|
-
assert_equal( 11, X.new.n )
|
45
|
-
end
|
46
|
-
def test_included_and_redefined
|
47
|
-
assert_equal( 44, K.n )
|
48
|
-
assert_equal( K, K.s )
|
49
|
-
end
|
50
|
-
def test_included_again
|
51
|
-
assert_equal( 44, Z.n )
|
52
|
-
assert_equal( Z, Z.s )
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
56
|
-
|
data/test/more/test_crypt.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
# Test facets/crypt.rb
|
2
|
-
|
3
|
-
require "facets/crypt.rb"
|
4
|
-
require "test/unit"
|
5
|
-
|
6
|
-
class CryptTest < Test::Unit::TestCase
|
7
|
-
|
8
|
-
def array_test(arr, algo)
|
9
|
-
arr.each do |password, hash|
|
10
|
-
assert(Crypt.check(password, hash, algo))
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_md5
|
15
|
-
a = [ [' ', '$1$yiiZbNIH$YiCsHZjcTkYd31wkgW8JF.'],
|
16
|
-
['pass', '$1$YeNsbWdH$wvOF8JdqsoiLix754LTW90'],
|
17
|
-
['____fifteen____', '$1$s9lUWACI$Kk1jtIVVdmT01p0z3b/hw1'],
|
18
|
-
['____sixteen_____', '$1$dL3xbVZI$kkgqhCanLdxODGq14g/tW1'],
|
19
|
-
['____seventeen____', '$1$NaH5na7J$j7y8Iss0hcRbu3kzoJs5V.'],
|
20
|
-
['__________thirty-three___________', '$1$HO7Q6vzJ$yGwp2wbL5D7eOVzOmxpsy.'],
|
21
|
-
['apache', '$apr1$J.w5a/..$IW9y6DR0oO/ADuhlMF5/X1']
|
22
|
-
]
|
23
|
-
array_test(a, :md5)
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_bad_algo
|
27
|
-
assert_raise(ArgumentError) do
|
28
|
-
Crypt.crypt("qsdf", :qsdf)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
@@ -1,69 +0,0 @@
|
|
1
|
-
# Test facets/dependency.rb
|
2
|
-
|
3
|
-
require 'facets/dependency.rb'
|
4
|
-
require 'test/unit'
|
5
|
-
|
6
|
-
class DependableTest1 < Test::Unit::TestCase
|
7
|
-
|
8
|
-
class C
|
9
|
-
#extend MethodDependency
|
10
|
-
|
11
|
-
attr :s
|
12
|
-
def initialize
|
13
|
-
@s = ''
|
14
|
-
end
|
15
|
-
|
16
|
-
def x ; @s << 'x'; end
|
17
|
-
def y ; @s << 'y'; end
|
18
|
-
def z ; @s << 'z'; end
|
19
|
-
|
20
|
-
depend :x => :y
|
21
|
-
depend :z => [:x, :y]
|
22
|
-
end
|
23
|
-
|
24
|
-
module M
|
25
|
-
#extend MethodDependency
|
26
|
-
|
27
|
-
attr :s
|
28
|
-
def initialize
|
29
|
-
@s = ''
|
30
|
-
end
|
31
|
-
|
32
|
-
def x ; @s << 'x'; end
|
33
|
-
def y ; @s << 'y'; end
|
34
|
-
def z ; @s << 'z'; end
|
35
|
-
|
36
|
-
depend :x => :y
|
37
|
-
depend :z => [:x, :y]
|
38
|
-
end
|
39
|
-
|
40
|
-
class D
|
41
|
-
include M
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_01
|
45
|
-
c = C.new
|
46
|
-
c.x
|
47
|
-
assert_equal( 'yx', c.s )
|
48
|
-
end
|
49
|
-
|
50
|
-
def test_02
|
51
|
-
c = C.new
|
52
|
-
c.z
|
53
|
-
assert_equal( 'yxz', c.s )
|
54
|
-
end
|
55
|
-
|
56
|
-
def test_03
|
57
|
-
c = D.new
|
58
|
-
c.x
|
59
|
-
assert_equal( 'yx', c.s )
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_04
|
63
|
-
c = D.new
|
64
|
-
c.z
|
65
|
-
assert_equal( 'yxz', c.s )
|
66
|
-
end
|
67
|
-
|
68
|
-
end
|
69
|
-
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# Test lib/more/ext/enumerable/elementwise.rb'
|
2
|
-
|
3
|
-
require 'facets/elementwise.rb'
|
4
|
-
require 'test/unit'
|
5
|
-
|
6
|
-
class TestElementWise < Test::Unit::TestCase
|
7
|
-
|
8
|
-
def test_elementwise
|
9
|
-
a = [1,2,3]
|
10
|
-
b = [4,5]
|
11
|
-
assert_equal( [4,5,6], a.elementwise + 3 )
|
12
|
-
assert_equal( [5,7], a.elementwise + b )
|
13
|
-
assert_equal( [[5,7],[3,4,5]], a.elementwise.+(b,2) )
|
14
|
-
assert_equal( [[5,7],[4,5,6]], a.elementwise.+(b,3) )
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_ewise
|
18
|
-
a = [1,2,3]
|
19
|
-
assert_equal( [4,5,6], a.ewise + 3 )
|
20
|
-
assert_equal( [5,7], a.ewise + [4,5] )
|
21
|
-
assert_equal( [[5,7],[3,4,5]], a.ewise.+([4,5],2) )
|
22
|
-
assert_equal( [[5,7],[4,5,6]], a.ewise.+([4,5],3) )
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
data/test/more/test_infinity.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
# Test facets/infinity.rb
|
2
|
-
|
3
|
-
require 'facets/infinity.rb'
|
4
|
-
|
5
|
-
require 'test/unit'
|
6
|
-
|
7
|
-
class GeneralTest < Test::Unit::TestCase
|
8
|
-
|
9
|
-
def test_pos
|
10
|
-
assert_equal((1.0/0), INFINITY.to_f)
|
11
|
-
assert_equal(1, INFINITY<=>5)
|
12
|
-
assert_equal(1, INFINITY<=>"a")
|
13
|
-
assert_equal("PosInf", INFINITY.to_s)
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_neg
|
17
|
-
assert_equal((-1.0/0), -INFINITY.to_f)
|
18
|
-
assert_equal(-1, -INFINITY<=>5)
|
19
|
-
assert_equal(-1, -INFINITY<=>"a")
|
20
|
-
assert_equal("NegInf", (-INFINITY).to_s)
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_ord
|
24
|
-
assert_equal((-1.0/0), -INFINITY.to_f)
|
25
|
-
assert_equal(-1, 5<=>INFINITY)
|
26
|
-
assert_equal(1, 5<=>-INFINITY)
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_eq
|
30
|
-
assert_equal(Inf, Inf)
|
31
|
-
assert_equal(-Inf, -Inf)
|
32
|
-
assert_equal(PosInf, PosInf)
|
33
|
-
assert_equal(NegInf, NegInf)
|
34
|
-
assert_not_equal(NaN, NaN)
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
|
40
|
-
|
data/test/more/test_interval.rb
DELETED
@@ -1,151 +0,0 @@
|
|
1
|
-
# Test facets/interval.rb
|
2
|
-
|
3
|
-
require 'facets/interval.rb'
|
4
|
-
|
5
|
-
require 'test/unit'
|
6
|
-
|
7
|
-
class InclusiveTest < Test::Unit::TestCase
|
8
|
-
|
9
|
-
def setup
|
10
|
-
@a = Interval.new( 1, 10 )
|
11
|
-
@b = Interval.new( 1, 10, true, false )
|
12
|
-
@c = Interval.new( 1, 10, false, true )
|
13
|
-
@d = Interval.new( 1, 10, true, true )
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_001A ; assert_equal( false, @a.include?(0) ) ; end
|
17
|
-
def test_002A ; assert_equal( true, @a.include?(1) ) ; end
|
18
|
-
def test_003A ; assert_equal( true, @a.include?(2) ) ; end
|
19
|
-
def test_004A ; assert_equal( true, @a.include?(9) ) ; end
|
20
|
-
def test_005A ; assert_equal( true, @a.include?(10) ) ; end
|
21
|
-
def test_006A ; assert_equal( false, @a.include?(11) ) ; end
|
22
|
-
|
23
|
-
def test_001B ; assert_equal( false, @b.include?(0) ) ; end
|
24
|
-
def test_002B ; assert_equal( false, @b.include?(1) ) ; end
|
25
|
-
def test_003B ; assert_equal( true, @b.include?(2) ) ; end
|
26
|
-
def test_004B ; assert_equal( true, @b.include?(9) ) ; end
|
27
|
-
def test_005B ; assert_equal( true, @b.include?(10) ) ; end
|
28
|
-
def test_006B ; assert_equal( false, @b.include?(11) ) ; end
|
29
|
-
|
30
|
-
def test_001C ; assert_equal( false, @c.include?(0) ) ; end
|
31
|
-
def test_002C ; assert_equal( true, @c.include?(1) ) ; end
|
32
|
-
def test_003C ; assert_equal( true, @c.include?(2) ) ; end
|
33
|
-
def test_004C ; assert_equal( true, @c.include?(9) ) ; end
|
34
|
-
def test_005C ; assert_equal( false, @c.include?(10) ) ; end
|
35
|
-
def test_006C ; assert_equal( false, @c.include?(11) ) ; end
|
36
|
-
|
37
|
-
def test_001D ; assert_equal( false, @d.include?(0) ) ; end
|
38
|
-
def test_002D ; assert_equal( false, @d.include?(1) ) ; end
|
39
|
-
def test_003D ; assert_equal( true, @d.include?(2) ) ; end
|
40
|
-
def test_004D ; assert_equal( true, @d.include?(9) ) ; end
|
41
|
-
def test_005D ; assert_equal( false, @d.include?(10) ) ; end
|
42
|
-
def test_006D ; assert_equal( false, @d.include?(11) ) ; end
|
43
|
-
|
44
|
-
end
|
45
|
-
|
46
|
-
class LrgNumericTest < Test::Unit::TestCase
|
47
|
-
|
48
|
-
def setup
|
49
|
-
@a = Interval.new(0,100000000)
|
50
|
-
@b = Interval.new(0,100000000)
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_001A ; assert_equal( true, @a.include?(0) ) ; end
|
54
|
-
def test_002A ; assert_equal( true, @a.include?(1000) ) ; end
|
55
|
-
def test_003A ; assert_equal( true, @a.include?(1000000) ) ; end
|
56
|
-
def test_004A ; assert_equal( true, @a.include?(100000000) ) ; end
|
57
|
-
#def test_005A ; assert_equal( false, @a.include?(INFINITY) ) ; end
|
58
|
-
|
59
|
-
def test_001B ; assert_equal( true, @b.include?(0) ) ; end
|
60
|
-
def test_002B ; assert_equal( true, @b.include?(5) ) ; end
|
61
|
-
def test_003B ; assert_equal( true, @b.include?(70007) ) ; end
|
62
|
-
def test_004B ; assert_equal( true, @b.include?(5000005) ) ; end
|
63
|
-
#def test_005B ; assert_equal( false, @b.include?(INFINITY) ) ; end
|
64
|
-
|
65
|
-
end
|
66
|
-
|
67
|
-
class TC_SelectTest < Test::Unit::TestCase
|
68
|
-
|
69
|
-
def setup
|
70
|
-
@a = Interval.new( 0,10 )
|
71
|
-
end
|
72
|
-
|
73
|
-
def test_001
|
74
|
-
b = @a.collect( 2 ){ |n| n }
|
75
|
-
assert_equal( [0,2,4,6,8,10], b )
|
76
|
-
end
|
77
|
-
|
78
|
-
def test_002
|
79
|
-
b = @a.select{ |n| n % 2 == 0 }
|
80
|
-
assert_equal( [0,2,4,6,8,10], b )
|
81
|
-
end
|
82
|
-
|
83
|
-
def test_003
|
84
|
-
b = @a.collect( 1,2 ){ |n| n }
|
85
|
-
assert_equal( [0,5,10], b )
|
86
|
-
end
|
87
|
-
|
88
|
-
def test_004
|
89
|
-
b = @a.select( 1,2 ){ |n| n % 2 == 0 }
|
90
|
-
assert_equal( [0,10], b )
|
91
|
-
end
|
92
|
-
|
93
|
-
end
|
94
|
-
|
95
|
-
class ArrayTest < Test::Unit::TestCase
|
96
|
-
|
97
|
-
def setup
|
98
|
-
@a = Interval.new( 0,10 )
|
99
|
-
@b = Interval.new( 0,1 )
|
100
|
-
end
|
101
|
-
|
102
|
-
def test_001A ; assert_equal( [0,5,10], @a.to_a(1,2) ) ; end
|
103
|
-
|
104
|
-
def test_001B ; assert_equal( [0, 0.25, 0.5, 0.75, 1.0], @b.to_a(1,4) ) ; end
|
105
|
-
|
106
|
-
end
|
107
|
-
|
108
|
-
|
109
|
-
=begin
|
110
|
-
class InfTest < Test::Unit::TestCase
|
111
|
-
|
112
|
-
def setup
|
113
|
-
@a = Interval.new( -INFINITY, -3 )
|
114
|
-
@b = Interval.new( -INFINITY, -3, true, false )
|
115
|
-
@c = Interval.new( -3, INFINITY )
|
116
|
-
@d = Interval.new( -INFINITY, INFINITY )
|
117
|
-
@e = Interval.new( -3, -2 )
|
118
|
-
end
|
119
|
-
|
120
|
-
def test_001A ; assert_equal( true, @a.include?(-INFINITY) ) ; end
|
121
|
-
def test_002A ; assert_equal( true, @a.include?(-4) ) ; end
|
122
|
-
def test_003A ; assert_equal( true, @a.include?(-3) ) ; end
|
123
|
-
def test_004A ; assert_equal( false, @a.include?(-2) ) ; end
|
124
|
-
def test_005A ; assert_equal( false, @a.include?(INFINITY) ) ; end
|
125
|
-
|
126
|
-
def test_001B ; assert_equal( true, @b.include?(-INFINITY) ) ; end
|
127
|
-
def test_002B ; assert_equal( true, @b.include?(-4) ) ; end
|
128
|
-
def test_003B ; assert_equal( false, @b.include?(-3) ) ; end
|
129
|
-
def test_004B ; assert_equal( false, @b.include?(-2) ) ; end
|
130
|
-
def test_005B ; assert_equal( false, @b.include?(INFINITY) ) ; end
|
131
|
-
|
132
|
-
def test_001C ; assert_equal( false, @c.include?(-INFINITY) ) ; end
|
133
|
-
def test_002C ; assert_equal( false, @c.include?(-4) ) ; end
|
134
|
-
def test_003C ; assert_equal( true, @c.include?(-3) ) ; end
|
135
|
-
def test_004C ; assert_equal( true, @c.include?(-2) ) ; end
|
136
|
-
def test_005C ; assert_equal( true, @c.include?(INFINITY) ) ; end
|
137
|
-
|
138
|
-
def test_001D ; assert_equal( true, @d.include?(-INFINITY) ) ; end
|
139
|
-
def test_002D ; assert_equal( true, @d.include?(-4) ) ; end
|
140
|
-
def test_003D ; assert_equal( true, @d.include?(-3) ) ; end
|
141
|
-
def test_004D ; assert_equal( true, @d.include?(-2) ) ; end
|
142
|
-
def test_005D ; assert_equal( true, @d.include?(INFINITY) ) ; end
|
143
|
-
|
144
|
-
def test_001E ; assert_equal( false, @e.include?(-INFINITY) ) ; end
|
145
|
-
def test_002E ; assert_equal( false, @e.include?(-4) ) ; end
|
146
|
-
def test_003E ; assert_equal( true, @e.include?(-3) ) ; end
|
147
|
-
def test_004E ; assert_equal( true, @e.include?(-2) ) ; end
|
148
|
-
def test_005E ; assert_equal( false, @e.include?(INFINITY) ) ; end
|
149
|
-
|
150
|
-
end
|
151
|
-
=end
|