facets 2.5.0 → 2.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (191) hide show
  1. data/AUTHORS +1 -1
  2. data/CHANGES +28 -45
  3. data/MANIFEST +35 -4
  4. data/README +3 -14
  5. data/RELEASE +36 -70
  6. data/VERSION +1 -1
  7. data/doc/archive/RELEASE-2.5.0 +83 -0
  8. data/doc/log/basic_stats/index.html +4 -4
  9. data/doc/log/changelog.html +509 -2
  10. data/doc/log/changelog.txt +130 -1522
  11. data/doc/rdoc/core/classes/Array.html +366 -141
  12. data/doc/rdoc/core/classes/Binding.html +45 -45
  13. data/doc/rdoc/core/classes/Class.html +38 -38
  14. data/doc/rdoc/core/classes/Comparable.html +26 -26
  15. data/doc/rdoc/core/classes/Enumerable.html +174 -170
  16. data/doc/rdoc/core/classes/Enumerable/Enumerator.html +130 -0
  17. data/doc/rdoc/core/classes/Enumerator.html +132 -0
  18. data/doc/rdoc/core/classes/Exception.html +8 -8
  19. data/doc/rdoc/core/classes/File.html +58 -58
  20. data/doc/rdoc/core/classes/FileTest.html +4 -4
  21. data/doc/rdoc/core/classes/Float.html +8 -8
  22. data/doc/rdoc/core/classes/Functor.html +12 -12
  23. data/doc/rdoc/core/classes/Hash.html +447 -263
  24. data/doc/rdoc/core/classes/Indexable.html +110 -110
  25. data/doc/rdoc/core/classes/Integer.html +2 -2
  26. data/doc/rdoc/core/classes/Kernel.html +329 -329
  27. data/doc/rdoc/core/classes/Lazy/Promise.html +1 -1
  28. data/doc/rdoc/core/classes/MatchData.html +15 -15
  29. data/doc/rdoc/core/classes/Module.html +176 -157
  30. data/doc/rdoc/core/classes/NilClass.html +23 -23
  31. data/doc/rdoc/core/classes/Numeric.html +27 -27
  32. data/doc/rdoc/core/classes/Object.html +8 -8
  33. data/doc/rdoc/core/classes/ObjectSpace.html +5 -5
  34. data/doc/rdoc/core/classes/Proc.html +22 -22
  35. data/doc/rdoc/core/classes/Regexp.html +1 -1
  36. data/doc/rdoc/core/classes/Stackable.html +31 -31
  37. data/doc/rdoc/core/classes/String.html +332 -291
  38. data/doc/rdoc/core/classes/Symbol.html +1 -1
  39. data/doc/rdoc/core/classes/TrueClass.html +8 -8
  40. data/doc/rdoc/core/classes/UnboundMethod.html +18 -13
  41. data/doc/rdoc/core/created.rid +1 -1
  42. data/doc/rdoc/core/files/README.html +7 -29
  43. data/doc/rdoc/core/files/lib/core/facets/array/product_rb.html +1 -1
  44. data/doc/rdoc/core/files/lib/core/facets/enumerable/collect_rb.html +10 -1
  45. data/doc/rdoc/core/files/lib/core/facets/enumerable/compact_map_rb.html +92 -0
  46. data/doc/rdoc/core/files/lib/core/facets/enumerable/map_with_index_rb.html +92 -0
  47. data/doc/rdoc/core/files/lib/core/facets/enumerable/split_rb.html +1 -1
  48. data/doc/rdoc/core/files/lib/core/facets/hash/collate_rb.html +1 -1
  49. data/doc/rdoc/core/files/lib/core/facets/hash/group_by_value_rb.html +92 -0
  50. data/doc/rdoc/core/files/lib/core/facets/hash/new_with_rb.html +92 -0
  51. data/doc/rdoc/core/files/lib/core/facets/module/conflict_rb.html +1 -1
  52. data/doc/rdoc/core/files/lib/core/facets/module/extend_rb.html +92 -0
  53. data/doc/rdoc/core/files/lib/core/facets/string/align_rb.html +1 -1
  54. data/doc/rdoc/core/files/lib/core/facets/string/file_rb.html +96 -0
  55. data/doc/rdoc/core/files/lib/core/facets/string/xor_rb.html +1 -1
  56. data/doc/rdoc/core/files/lib/core/facets/to_hash_rb.html +5 -1
  57. data/doc/rdoc/core/files/lib/core/facets/unboundmethod/name_rb.html +1 -1
  58. data/doc/rdoc/core/fr_class_index.html +2 -0
  59. data/doc/rdoc/core/fr_file_index.html +6 -0
  60. data/doc/rdoc/core/fr_method_index.html +386 -373
  61. data/doc/rdoc/lore/classes/OpenStruct.html +6 -4
  62. data/doc/rdoc/lore/created.rid +1 -1
  63. data/doc/rdoc/lore/files/README.html +7 -29
  64. data/doc/rdoc/lore/files/lib/lore/facets/ostruct_rb.html +1 -1
  65. data/doc/rdoc/more/classes/ANSICode.html +66 -66
  66. data/doc/rdoc/more/classes/Advisable.html +37 -37
  67. data/doc/rdoc/more/classes/Advisable/Method.html +20 -20
  68. data/doc/rdoc/more/classes/Archive/Tar/Minitar.html +27 -27
  69. data/doc/rdoc/more/classes/Archive/Tar/Minitar/Input.html +28 -28
  70. data/doc/rdoc/more/classes/Archive/Tar/Minitar/Output.html +19 -19
  71. data/doc/rdoc/more/classes/Archive/Tar/Minitar/Reader.html +31 -31
  72. data/doc/rdoc/more/classes/Archive/Tar/Minitar/Writer.html +33 -33
  73. data/doc/rdoc/more/classes/Association.html +67 -53
  74. data/doc/rdoc/more/classes/Association/Kernel.html +11 -12
  75. data/doc/rdoc/more/classes/BBCode.html +36 -36
  76. data/doc/rdoc/more/classes/BaseX.html +16 -16
  77. data/doc/rdoc/more/classes/BiCrypt.html +67 -67
  78. data/doc/rdoc/more/classes/BinReadable.html +85 -85
  79. data/doc/rdoc/more/classes/BinReadable/ByteOrder.html +25 -25
  80. data/doc/rdoc/more/classes/Binding.html +8 -8
  81. data/doc/rdoc/more/classes/Buildable.html +4 -4
  82. data/doc/rdoc/more/classes/Cloneable.html +4 -4
  83. data/doc/rdoc/more/classes/ConsoleUtils.html +18 -18
  84. data/doc/rdoc/more/classes/Crypt.html +16 -16
  85. data/doc/rdoc/more/classes/CssTree.html +8 -8
  86. data/doc/rdoc/more/classes/Dictionary.html +52 -45
  87. data/doc/rdoc/more/classes/Enumerable.html +50 -50
  88. data/doc/rdoc/more/classes/Enumerable/Elementor.html +16 -16
  89. data/doc/rdoc/more/classes/Enumerable/Enumerator.html +4 -4
  90. data/doc/rdoc/more/classes/Enumerable/Filterable.html +30 -30
  91. data/doc/rdoc/more/classes/EnumerablePass.html +15 -15
  92. data/doc/rdoc/more/classes/Equatable.html +16 -16
  93. data/doc/rdoc/more/classes/Expirable.html +17 -17
  94. data/doc/rdoc/more/classes/Fileable.html +14 -14
  95. data/doc/rdoc/more/classes/Fileable/DSL.html +41 -41
  96. data/doc/rdoc/more/classes/Hash2Xml.html +4 -4
  97. data/doc/rdoc/more/classes/Hook.html +162 -0
  98. data/doc/rdoc/more/classes/HtmlFilter.html +9 -9
  99. data/doc/rdoc/more/classes/Instantiable.html +9 -9
  100. data/doc/rdoc/more/classes/Instantize.html +8 -8
  101. data/doc/rdoc/more/classes/Interval.html +187 -187
  102. data/doc/rdoc/more/classes/It.html +12 -12
  103. data/doc/rdoc/more/classes/Matcher.html +38 -38
  104. data/doc/rdoc/more/classes/Matcher/MatchData.html +4 -4
  105. data/doc/rdoc/more/classes/Memoizer.html +21 -21
  106. data/doc/rdoc/more/classes/Multiton.html +12 -12
  107. data/doc/rdoc/more/classes/Multiton/MetaMethods.html +28 -28
  108. data/doc/rdoc/more/classes/Net/SMTP.html +8 -8
  109. data/doc/rdoc/more/classes/OpEsc.html +5 -5
  110. data/doc/rdoc/more/classes/OpenCascade.html +4 -4
  111. data/doc/rdoc/more/classes/OpenHash.html +9 -9
  112. data/doc/rdoc/more/classes/OpenStructable.html +36 -36
  113. data/doc/rdoc/more/classes/PQueue.html +84 -84
  114. data/doc/rdoc/more/classes/Paramix.html +16 -16
  115. data/doc/rdoc/more/classes/Paramix/Delegator.html +16 -16
  116. data/doc/rdoc/more/classes/RWDelegator.html +16 -16
  117. data/doc/rdoc/more/classes/Random.html +5 -5
  118. data/doc/rdoc/more/classes/Random/Array.html +37 -37
  119. data/doc/rdoc/more/classes/Random/Hash.html +52 -52
  120. data/doc/rdoc/more/classes/Random/Object.html +4 -4
  121. data/doc/rdoc/more/classes/Random/String.html +34 -34
  122. data/doc/rdoc/more/classes/Random/String/Self.html +9 -9
  123. data/doc/rdoc/more/classes/Registerable.html +13 -13
  124. data/doc/rdoc/more/classes/Stash.html +28 -28
  125. data/doc/rdoc/more/classes/String/Mask.html +72 -72
  126. data/doc/rdoc/more/classes/String/Words.html +31 -31
  127. data/doc/rdoc/more/classes/System.html +253 -253
  128. data/doc/rdoc/more/classes/Timer.html +48 -48
  129. data/doc/rdoc/more/classes/Timer/Dummy.html +9 -9
  130. data/doc/rdoc/more/classes/Tuple.html +170 -170
  131. data/doc/rdoc/more/classes/TypeCast/Class.html +4 -4
  132. data/doc/rdoc/more/classes/TypeCast/Object.html +4 -4
  133. data/doc/rdoc/more/classes/Uninheritable.html +6 -6
  134. data/doc/rdoc/more/classes/X.html +117 -0
  135. data/doc/rdoc/more/classes/XOXO.html +11 -11
  136. data/doc/rdoc/more/classes/ZipUtils.html +88 -88
  137. data/doc/rdoc/more/classes/ZipUtils/DryRun.html +68 -68
  138. data/doc/rdoc/more/classes/ZipUtils/NoWrite.html +68 -68
  139. data/doc/rdoc/more/classes/ZipUtils/Verbose.html +60 -60
  140. data/doc/rdoc/more/created.rid +1 -1
  141. data/doc/rdoc/more/files/README.html +7 -29
  142. data/doc/rdoc/more/files/lib/more/facets/association_rb.html +1 -1
  143. data/doc/rdoc/more/files/lib/more/facets/dictionary_rb.html +1 -1
  144. data/doc/rdoc/more/files/lib/more/facets/hook_rb.html +96 -0
  145. data/doc/rdoc/more/files/lib/more/facets/paramix_rb.html +1 -1
  146. data/doc/rdoc/more/files/lib/more/facets/xoxo_rb.html +2 -2
  147. data/doc/rdoc/more/fr_class_index.html +2 -0
  148. data/doc/rdoc/more/fr_file_index.html +1 -0
  149. data/doc/rdoc/more/fr_method_index.html +686 -681
  150. data/lib/core/facets/array/product.rb +6 -23
  151. data/lib/core/facets/enumerable/collect.rb +3 -53
  152. data/lib/core/facets/enumerable/compact_map.rb +35 -0
  153. data/lib/core/facets/enumerable/map_with_index.rb +23 -0
  154. data/lib/core/facets/enumerable/split.rb +3 -3
  155. data/lib/core/facets/hash/collate.rb +45 -14
  156. data/lib/core/facets/hash/group_by_value.rb +65 -0
  157. data/lib/core/facets/hash/new_with.rb +15 -0
  158. data/lib/core/facets/module/extend.rb +11 -0
  159. data/lib/core/facets/string/align.rb +19 -18
  160. data/lib/core/facets/string/file.rb +17 -0
  161. data/lib/core/facets/string/xor.rb +9 -3
  162. data/lib/core/facets/to_hash.rb +274 -17
  163. data/lib/core/facets/unboundmethod/name.rb +4 -2
  164. data/lib/lore/facets/ostruct.rb +3 -0
  165. data/lib/more/facets/association.rb +28 -12
  166. data/lib/more/facets/dictionary.rb +10 -4
  167. data/lib/more/facets/hook.rb +65 -0
  168. data/lib/more/facets/paramix.rb +5 -5
  169. data/meta/abstract +13 -0
  170. data/meta/authors +1 -0
  171. data/meta/contact +1 -0
  172. data/meta/contributors +48 -0
  173. data/meta/created +1 -0
  174. data/meta/homepage +1 -0
  175. data/meta/license +1 -0
  176. data/meta/loadpath +3 -0
  177. data/meta/releases +14 -0
  178. data/meta/slogan +1 -0
  179. data/meta/summary +1 -0
  180. data/task/test.rake +116 -18
  181. data/test/core/array/test_product.rb +0 -6
  182. data/test/core/binding/test_local_variables.rb +9 -3
  183. data/test/core/enumerable/test_split.rb +19 -0
  184. data/test/core/module/test_conflict.rb +8 -3
  185. data/test/core/test_to_hash.rb +152 -0
  186. data/test/core/unboundmethod/test_arguments.rb +1 -1
  187. data/test/core/unboundmethod/test_name.rb +2 -2
  188. metadata +39 -8
  189. data/doc/log/bstats/stats.html +0 -39
  190. data/doc/log/stats.html +0 -25
  191. data/test/more/test_to_hash.rb +0 -58
@@ -239,7 +239,6 @@ class Dictionary
239
239
  end
240
240
 
241
241
  #
242
-
243
242
  def reorder
244
243
  if @order_by
245
244
  assoc = @order.collect{ |k| [k,@hash[k]] }.sort_by(&@order_by)
@@ -352,9 +351,16 @@ class Dictionary
352
351
  self == hsh2 ? nil : hsh2
353
352
  end
354
353
 
355
- def replace( hsh2 )
356
- @order = hsh2.order
357
- @hash = hsh2.hash
354
+ def replace(hsh2)
355
+ case hsh2
356
+ when Hash
357
+ @order = hsh2.keys
358
+ @hash = hsh2
359
+ else
360
+ @order = hsh2.order
361
+ @hash = hsh2.hash
362
+ end
363
+ reorder
358
364
  end
359
365
 
360
366
  def shift
@@ -0,0 +1,65 @@
1
+
2
+ # TODO: hooks should be an inheritor
3
+ #
4
+ module Hook
5
+
6
+ def self.append_features(base)
7
+ base.extend self
8
+ end
9
+
10
+ def hooks
11
+ @hooks ||= Hash.new{ |h,k| h[k] = [] }
12
+ end
13
+
14
+ def hook(name)
15
+ name = name.to_sym
16
+
17
+ (class << self; self; end).class_eval %{
18
+ def #{name}(meth=nil, &blk)
19
+ hooks[:#{name}] << (meth || blk)
20
+ end
21
+ }
22
+
23
+ module_eval %{
24
+ def #{name}(*args)
25
+ self.class.hooks[:#{name}].each do |blk|
26
+ if Proc === blk
27
+ blk.call(:#{name}, *args)
28
+ else
29
+ __send__(blk, :#{name}, *args)
30
+ end
31
+ end
32
+ end
33
+ }
34
+ end
35
+
36
+ end
37
+
38
+
39
+ #=begin demo
40
+
41
+ class X
42
+ include Hook
43
+
44
+ hook :signal
45
+
46
+ def boom(event, message)
47
+ puts "Kaboom!"
48
+ end
49
+
50
+ signal do |event, message|
51
+ puts "1", event, message
52
+ end
53
+
54
+ signal do |event, message|
55
+ puts "2", event, message
56
+ end
57
+
58
+ signal :boom
59
+
60
+ end
61
+
62
+ X.new.signal("hi")
63
+
64
+ #=end
65
+
@@ -44,19 +44,19 @@ require 'facets/module/modspace'
44
44
  # end
45
45
  #
46
46
  # class MyClass
47
- # include Mixin[:name => 'Ruby']
47
+ # include MyMixin[:name => 'Ruby']
48
48
  # end
49
49
  #
50
50
  # m = MyClass.new
51
- # m.hello -> 'Hello from Ruby!'
51
+ # m.hello #=> 'Hello from Ruby!'
52
52
  #
53
53
  # You can view the full set of parameters via the #mixin_parameters
54
54
  # class method, which returns a hash keyed on the included modules.
55
55
  #
56
- # MyClass.mixin_parameters #=> {MyMixin=>{:name=>'Ruby'}}
56
+ # MyClass.mixin_parameters #=> {MyMixin=>{:name=>'Ruby'}}
57
57
  # MyClass.mixin_parameters[MyMixin] #=> {:name=>'ruby'}
58
58
  #
59
- # The include Praamix is equivalent to:
59
+ # The include Paramix is equivalent to:
60
60
  #
61
61
  # def [](parameters)
62
62
  # Paramix.new(self, parameters)
@@ -65,7 +65,7 @@ require 'facets/module/modspace'
65
65
  # Paramix.new can also take a block that injects code into the class
66
66
  # or module including the parametric mixin. This is useful as an
67
67
  # alternative to using the #included callback for creating dynamic
68
- # mixins.. For example:
68
+ # mixins. For example:
69
69
  #
70
70
  # def self.[](parameters)
71
71
  # Paramix.new(self, parameters) do
@@ -0,0 +1,13 @@
1
+ Facets is the single largest collection of core extension methods
2
+ and standard class additions available for the Ruby programming
3
+ language.
4
+
5
+ Premium Core Extensions and Standard Additions.
6
+ Facets is a large collection of core extension methods
7
+ and standard additions for the Ruby programming language.
8
+ The core extensions are unique by virtue of thier atomicity.
9
+ Methods are stored in small, tightly related collections,
10
+ allowing for highly granular control of requirements.
11
+ The modules include a variety of useful classes, mixins
12
+ and microframeworks, from the Functor to a complete
13
+ Annotations system.
@@ -0,0 +1 @@
1
+ Thomas Sawyer <transfire@gmail.com>
@@ -0,0 +1 @@
1
+ facets-universal@rubyforge.org
@@ -0,0 +1,48 @@
1
+ Trans <transfire@gmail.com>
2
+ Matthew Harris
3
+ Noah Gibbs
4
+ Thibaut Barrère
5
+ Daniel J. Berger
6
+ Paul Brannan
7
+ Mikael Brockman
8
+ Jamis Buck
9
+ Renald Buter
10
+ Shashank Date
11
+ Robert Feldt
12
+ Mauricio Fernandez
13
+ Florian Frank
14
+ Hal Fulton
15
+ Noah Gibbs
16
+ Michael Granger
17
+ Florian Gross
18
+ Sean O'Halpin
19
+ Matthew Harris
20
+ David Heinemeier Hansson
21
+ Thomas-Ivo Heinen
22
+ Dave Hoover
23
+ Ara T. Howard
24
+ MenTaLguY
25
+ Mohammad Khan
26
+ Richard Laugesen
27
+ Derek Lewis
28
+ Jan Molic
29
+ George Moschovitis
30
+ Michael Neumann
31
+ Tim Pease
32
+ Jonas Pfenniger
33
+ Ryan Platte
34
+ Oliver Renaud
35
+ Tyler Rick
36
+ Christoph Rippel
37
+ Daniel Schierbeck
38
+ Louis J Scoras
39
+ Gavin Sinclair
40
+ Tilo Sloboda
41
+ Phil Tomson
42
+ Peter Vanbroekhoven
43
+ Jim Weirich
44
+ Jeff Wood
45
+ Erik Veenstra
46
+ Austin Ziegler
47
+ Why The Lucky Stiff
48
+
@@ -0,0 +1 @@
1
+ 2004-12-16
@@ -0,0 +1 @@
1
+ http://facets.rubyforge.org
@@ -0,0 +1 @@
1
+ Ruby
@@ -0,0 +1,3 @@
1
+ lib/core
2
+ lib/lore
3
+ lib/more
@@ -0,0 +1,14 @@
1
+ facets 2.4.4 stable (2008-09-01)
2
+ facets 2.4.3 stable (2008-08-14)
3
+ facets 2.4.2 stable (2008-08-12)
4
+ facets 2.4.1 stable (2008-04-03)
5
+ facets 2.4.0 stable (2008-03-24)
6
+ facets 2.3.0 stable (2008-02-01)
7
+ facets 2.2.1 stable (2007-12-22)
8
+ facets 2.2.0 stable (2007-12-13)
9
+ facets 2.1.3 stable (2007-11-28)
10
+ facets 2.1.2 stable (2007-11-22)
11
+ facets 2.1.1 stable (2007-11-16)
12
+ facets 2.1.0 stable (2007-11-10)
13
+ facets 2.0.5 stable (2007-11-07)
14
+
@@ -0,0 +1 @@
1
+ ALL YOUR BASE ARE BELONG TO RUBY!
@@ -0,0 +1 @@
1
+ Premium Core Extensions and Standard Additions
@@ -1,40 +1,79 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- desc "run unit tests"
4
-
5
3
  task 'test' do
6
- run_tests
4
+ prepare_tests_all
5
+ end
6
+
7
+ desc "run all unit tests"
8
+ task 'test:all' do
9
+ prepare_tests_all
10
+ end
11
+
12
+ desc "run core unit tests"
13
+ task 'test:core' do
14
+ prepare_tests_core
15
+ end
16
+
17
+ desc "run lore unit tests"
18
+ task 'test:lore' do
19
+ prepare_tests_lore
7
20
  end
21
+
22
+ desc "run more unit tests"
23
+ task 'test:more' do
24
+ prepare_tests_more
25
+ end
26
+
27
+ desc "run all unit tests with ActiveSupport loaded"
28
+ task 'test:all:activesupport' => [:include_activesupport, 'test:all']
8
29
 
9
- desc "run unit tests with ActiveSupport loaded"
30
+ desc "run core unit tests with ActiveSupport loaded"
31
+ task 'test:core:activesupport' => [:include_activesupport, 'test:core']
10
32
 
11
- task 'test:activesupport' do
33
+ desc "run lore unit tests with ActiveSupport loaded"
34
+ task 'test:lore:activesupport' => [:include_activesupport, 'test:lore']
35
+
36
+ desc "run more unit tests with ActiveSupport loaded"
37
+ task 'test:more:activesupport' => [:include_activesupport, 'test:more']
38
+
39
+ task 'include_activesupport' do
12
40
  require 'activesupport'
13
- run_tests
14
41
  end
15
42
 
16
- def run_tests
17
- live = ENV['live']
18
43
 
44
+ def add_loadpath(*paths)
45
+ live = ENV['live']
46
+
19
47
  unless live
20
- $LOAD_PATH.unshift(File.expand_path('lib/core'))
21
- $LOAD_PATH.unshift(File.expand_path('lib/lore'))
22
- $LOAD_PATH.unshift(File.expand_path('lib/more'))
48
+ # $LOAD_PATH.unshift(File.expand_path('lib/core'))
49
+ # $LOAD_PATH.unshift(File.expand_path('lib/lore'))
50
+ # $LOAD_PATH.unshift(File.expand_path('lib/more'))
51
+ paths.each do |path|
52
+ $LOAD_PATH.unshift(File.expand_path(path))
53
+ end
23
54
  end
24
-
55
+
25
56
  puts "RUBY VERSION: #{RUBY_VERSION}"
26
- puts "LOAD PATH:\n" + $LOAD_PATH.join("\n")
27
-
57
+ puts "LOAD PATH:\n" + $LOAD_PATH.join("\n")
58
+ end
59
+
60
+ def get_tests(which="{c,l,m}ore")
28
61
  if find = ARGV[1..-1].select{|e| e !~ /(^[-]|[=])/ }[0]
29
62
  unless FileTest.file?(find)
30
- find = File.join(find, '**', 'test_*.rb')
63
+ #find = File.join(find, '**', 'test_*.rb')
64
+ find = ['test/test_*.rb']
65
+ find << File.join(find, which, '**', 'test_*.rb')
31
66
  end
32
67
  else
33
- find = 'test/**/test_*.rb'
68
+ #find = 'test/**/test_*.rb'
69
+ find = ['test/test_*.rb']
70
+ find << "test/#{which}/**/test_*.rb"
34
71
  end
72
+
73
+ Dir.glob(find)
74
+ end
35
75
 
36
- files = Dir.glob(find)
37
-
76
+ def run_tests(files)
38
77
  files.each do |file|
39
78
  next if File.directory?(file)
40
79
  begin
@@ -45,3 +84,62 @@ def run_tests
45
84
  end
46
85
  end
47
86
  end
87
+
88
+ def prepare_tests_all
89
+ add_loadpath('lib/core','lib/lore','lib/more')
90
+ files = get_tests
91
+ run_tests(files)
92
+ end
93
+
94
+ def prepare_tests_core
95
+ add_loadpath('lib/core')
96
+ files = get_tests('core')
97
+ run_tests(files)
98
+ end
99
+
100
+ def prepare_tests_lore
101
+ add_loadpath('lib/lore')
102
+ files = get_tests('lore')
103
+ run_tests(files)
104
+ end
105
+
106
+ def prepare_tests_more
107
+ add_loadpath('lib/more')
108
+ files = get_tests('more')
109
+ run_tests(files)
110
+ end
111
+
112
+
113
+ #def run_tests
114
+ # live = ENV['live']
115
+ #
116
+ # unless live
117
+ # $LOAD_PATH.unshift(File.expand_path('lib/core'))
118
+ # $LOAD_PATH.unshift(File.expand_path('lib/lore'))
119
+ # $LOAD_PATH.unshift(File.expand_path('lib/more'))
120
+ # end
121
+ #
122
+ # puts "RUBY VERSION: #{RUBY_VERSION}"
123
+ # puts "LOAD PATH:\n" + $LOAD_PATH.join("\n")
124
+ #
125
+ # if find = ARGV[1..-1].select{|e| e !~ /(^[-]|[=])/ }[0]
126
+ # unless FileTest.file?(find)
127
+ # find = File.join(find, '**', 'test_*.rb')
128
+ # end
129
+ # else
130
+ # find = 'test/**/test_*.rb'
131
+ # end
132
+ #
133
+ # files = Dir.glob(find)
134
+ #
135
+ # files.each do |file|
136
+ # next if File.directory?(file)
137
+ # begin
138
+ # puts "Loading: #{file}" if $DEBUG
139
+ # load(file)
140
+ # rescue LoadError
141
+ # puts "Error loading: #{file}"
142
+ # end
143
+ # end
144
+ #end
145
+
@@ -35,12 +35,6 @@ class TC_Array_Product < Test::Unit::TestCase
35
35
  assert_equal( [[1, 4],[1, 5],[1, 6],[2, 4],[2, 5],[2, 6],[3, 4],[3, 5],[3, 6]], a )
36
36
  end
37
37
 
38
- def test_product_03
39
- a = []
40
- [1,2,3].product([4,5,6]) {|elem| a << elem }
41
- assert_equal( [[1, 4],[1, 5],[1, 6],[2, 4],[2, 5],[2, 6],[3, 4],[3, 5],[3, 6]], a )
42
- end
43
-
44
38
  # def test_op_mod
45
39
  # a = [:A,:B,:C]
46
40
  # assert_equal( a[1], a/1 )
@@ -10,9 +10,15 @@ class TC_Binding_Local_Variables < Test::Unit::TestCase
10
10
  @bind = binding
11
11
  end
12
12
 
13
- def test_local_variables
14
- assert_equal( ["a","b","x"], @bind.local_variables )
15
- end
13
+ unless RUBY_VERSION > "1.9"
14
+ def test_local_variables
15
+ assert_equal( ["a","b","x"], @bind.local_variables )
16
+ end
17
+ else
18
+ def test_local_variables
19
+ assert_equal( [:a,:b,:x], @bind.local_variables )
20
+ end
21
+ end
16
22
 
17
23
  end
18
24
 
@@ -0,0 +1,19 @@
1
+ require 'test/unit'
2
+ require 'facets/enumerable/split'
3
+
4
+ class Test_Enumerable_Split < Test::Unit::TestCase
5
+
6
+ def test_empty
7
+ assert_equal( [], [].split('a') )
8
+ end
9
+
10
+ def test_same
11
+ assert_equal( [], ['a'].split('a') )
12
+ end
13
+
14
+ def test_split
15
+ assert_equal( [['a'], ['c']], ['a','b','c'].split('b') )
16
+ end
17
+
18
+ end
19
+
@@ -11,9 +11,14 @@ class Test_Module_Conflict < Test::Unit::TestCase
11
11
  def q; "qy"; end
12
12
  end
13
13
 
14
- def test_conflict?
15
- assert_equal( ["q"], X.conflict?(Y) )
14
+ if RUBY_VERSION < '1.9'
15
+ def test_conflict?
16
+ assert_equal( ["q"], X.conflict?(Y) )
17
+ end
18
+ else
19
+ def test_conflict?
20
+ assert_equal( [:q], X.conflict?(Y) )
21
+ end
16
22
  end
17
-
18
23
  end
19
24