facets 2.1.2 → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/lib/core/facets.rb +1 -1
  2. data/lib/core/facets/conversion.rb +6 -1
  3. data/lib/core/facets/enumerable/collate.rb +13 -24
  4. data/lib/core/facets/{main.rb → facets.rb} +0 -0
  5. data/lib/methods/facets/facets/require_core.rb +1 -1
  6. data/lib/more/facets/advice.rb +28 -1
  7. data/lib/more/facets/aop.rb +2 -9
  8. data/log/history.rd +5 -0
  9. data/meta/MANIFEST +2 -4
  10. data/meta/{rollrc → ROLLRC} +1 -1
  11. data/task/release +1 -3
  12. data/task/test/general +2 -2
  13. data/task/test/loadtest +1 -1
  14. data/test/unit/enumerable/test_collate.rb +46 -50
  15. data/test/unit/test_advice.rb +2 -0
  16. data/test/unit/test_annotations.rb +2 -0
  17. data/test/unit/test_arguments.rb +45 -61
  18. data/test/unit/test_association.rb +1 -7
  19. data/test/unit/test_attributes.rb +1 -7
  20. data/test/unit/test_autoarray.rb +1 -8
  21. data/test/unit/test_basicobject.rb +40 -56
  22. data/test/unit/test_bbcode.rb +14 -30
  23. data/test/unit/test_binreadable.rb +35 -51
  24. data/test/unit/test_boolean.rb +64 -80
  25. data/test/unit/test_buildable.rb +26 -41
  26. data/test/unit/test_buildingblock.rb +24 -39
  27. data/test/unit/test_bytes.rb +50 -66
  28. data/test/unit/test_class_extension.rb +43 -59
  29. data/test/unit/test_classmethods.rb +42 -58
  30. data/test/unit/test_compare_on.rb +40 -54
  31. data/test/unit/test_conversion.rb +143 -159
  32. data/test/unit/test_coroutine.rb +31 -47
  33. data/test/unit/test_crypt.rb +2 -11
  34. data/test/unit/test_curry.rb +19 -35
  35. data/test/unit/test_cut.rb +14 -30
  36. data/test/unit/test_date.rb +31 -47
  37. data/test/unit/test_dependency.rb +49 -64
  38. data/test/unit/test_dictionary.rb +1 -7
  39. data/test/unit/test_elementor.rb +45 -61
  40. data/test/unit/test_enumerablepass.rb +57 -73
  41. data/test/unit/test_functor.rb +21 -34
  42. data/test/unit/test_getoptlong.rb +17 -33
  43. data/test/unit/test_infinity.rb +1 -7
  44. data/test/unit/test_inheritor.rb +1 -7
  45. data/test/unit/test_instantiable.rb +14 -30
  46. data/test/unit/test_instantise.rb +20 -36
  47. data/test/unit/test_interface.rb +58 -65
  48. data/test/unit/test_interval.rb +1 -7
  49. data/test/unit/test_let.rb +11 -25
  50. data/test/unit/test_linkedlist.rb +38 -52
  51. data/test/unit/test_lrucache.rb +6 -22
  52. data/test/unit/test_mapsend.rb +12 -28
  53. data/test/unit/test_memoize.rb +17 -32
  54. data/test/unit/test_multipliers.rb +72 -87
  55. data/test/unit/test_namespace.rb +35 -51
  56. data/test/unit/test_opencascade.rb +47 -63
  57. data/test/unit/test_openobject.rb +94 -110
  58. data/test/unit/test_ostruct.rb +1 -7
  59. data/test/unit/test_overload.rb +1 -6
  60. data/test/unit/test_paramix.rb +1 -7
  61. data/test/unit/test_pp_s.rb +1 -7
  62. data/test/unit/test_prototype.rb +1 -6
  63. data/test/unit/test_recorder.rb +22 -37
  64. data/test/unit/test_snapshot.rb +2 -14
  65. data/test/unit/test_stylize.rb +113 -127
  66. data/test/unit/test_syncarray.rb +2 -15
  67. data/test/unit/test_synchash.rb +16 -28
  68. data/test/unit/test_timer.rb +2 -14
  69. data/test/unit/test_times.rb +64 -80
  70. data/test/unit/test_tuple.rb +40 -56
  71. data/test/unit/test_typecast.rb +29 -40
  72. data/test/unit/test_uninheritable.rb +30 -42
  73. metadata +4 -8
  74. data/test/lib/rq.rb +0 -15
@@ -1,59 +1,45 @@
1
- # _____ _
2
- # |_ _|__ ___| |_
3
- # | |/ _ \/ __| __|
4
- # | | __/\__ \ |
5
- # |_|\___||___/\__|
6
- #
7
- # for lib/facets/compare_on.rb
8
- #
9
- # Extracted Mon Sep 03 16:23:07 -0700 2007
10
- # w/ Test Extraction Ratchet
11
- #
12
-
13
- require 'facets/compare_on.rb'
14
-
15
-
16
-
17
- require 'test/unit'
18
-
19
- class TestModuleCompare < Test::Unit::TestCase
20
-
21
- def test_equate_on
22
- c = Class.new
23
- c.class_eval { attr_accessor :a, :b ; equate_on :a,:b }
24
- c1,c2 = c.new,c.new
25
- c1.a = 10; c1.b = 20
26
- c2.a = 10; c2.b = 20
27
- assert_equal( c1, c2 )
28
- c1.a = 10; c1.b = 10
29
- c2.a = 10; c2.b = 20
30
- assert_not_equal( c1, c2 )
31
- c1.a = 10; c1.b = 20
32
- c2.a = 20; c2.b = 20
33
- assert_not_equal( c1, c2 )
34
- end
35
-
36
- def test_sort_on
37
- c = Class.new
38
- c.class_eval {
39
- def initialize(a,b)
40
- @a=a; @b=b
41
- end
42
- sort_on :a,:b
43
- }
44
- a = [c.new(10,20),c.new(10,30)]
45
- assert_equal( a, a.sort )
46
- a = [c.new(10,30),c.new(10,20)]
47
- assert_equal( a.reverse, a.sort )
48
- a = [c.new(10,10),c.new(20,10)]
49
- assert_equal( a, a.sort )
50
- a = [c.new(20,10),c.new(10,10)]
51
- assert_equal( a.reverse, a.sort )
52
- a = [c.new(10,30),c.new(20,10)]
53
- assert_equal( a, a.sort )
54
- end
1
+ # Test facets/compare_on.rb
2
+
3
+ require 'facets/compare_on.rb'
4
+ require 'test/unit'
5
+
6
+ class TestModuleCompare < Test::Unit::TestCase
7
+
8
+ def test_equate_on
9
+ c = Class.new
10
+ c.class_eval { attr_accessor :a, :b ; equate_on :a,:b }
11
+ c1,c2 = c.new,c.new
12
+ c1.a = 10; c1.b = 20
13
+ c2.a = 10; c2.b = 20
14
+ assert_equal( c1, c2 )
15
+ c1.a = 10; c1.b = 10
16
+ c2.a = 10; c2.b = 20
17
+ assert_not_equal( c1, c2 )
18
+ c1.a = 10; c1.b = 20
19
+ c2.a = 20; c2.b = 20
20
+ assert_not_equal( c1, c2 )
21
+ end
55
22
 
23
+ def test_sort_on
24
+ c = Class.new
25
+ c.class_eval {
26
+ def initialize(a,b)
27
+ @a=a; @b=b
28
+ end
29
+ sort_on :a,:b
30
+ }
31
+ a = [c.new(10,20),c.new(10,30)]
32
+ assert_equal( a, a.sort )
33
+ a = [c.new(10,30),c.new(10,20)]
34
+ assert_equal( a.reverse, a.sort )
35
+ a = [c.new(10,10),c.new(20,10)]
36
+ assert_equal( a, a.sort )
37
+ a = [c.new(20,10),c.new(10,10)]
38
+ assert_equal( a.reverse, a.sort )
39
+ a = [c.new(10,30),c.new(20,10)]
40
+ assert_equal( a, a.sort )
56
41
  end
57
42
 
43
+ end
58
44
 
59
45
 
@@ -1,236 +1,220 @@
1
- # _____ _
2
- # |_ _|__ ___| |_
3
- # | |/ _ \/ __| __|
4
- # | | __/\__ \ |
5
- # |_|\___||___/\__|
6
- #
7
- # for lib/facets/conversions.rb
8
- #
9
- # Extracted Mon Sep 03 16:23:07 -0700 2007
10
- # w/ Test Extraction Ratchet
11
- #
1
+ # Test facets/conversions.rb
12
2
 
13
- require 'facets/conversion.rb'
3
+ require 'facets/conversion.rb'
4
+ require 'test/unit'
14
5
 
15
6
 
7
+ class TestArrayConversion < Test::Unit::TestCase
16
8
 
17
- require 'test/unit'
18
-
19
-
20
- class TestArrayConversion < Test::Unit::TestCase
21
-
22
- def test_to_h
23
- a = [[1,2],[3,4],[5,6]]
24
- assert_equal( { 1=>2, 3=>4, 5=>6 }, a.to_h )
25
- end
26
-
27
- def test_to_h_arrayed
28
- a = [[:a,1,2],[:b,3,4],[:c,5,6]]
29
- assert_equal( { :a=>[1,2], :b=>[3,4], :c=>[5,6] }, a.to_h(true) )
30
- end
9
+ def test_to_h
10
+ a = [[1,2],[3,4],[5,6]]
11
+ assert_equal( { 1=>2, 3=>4, 5=>6 }, a.to_h )
12
+ end
31
13
 
32
- def test_to_hash
33
- a = [:a,:b,:c]
34
- assert_equal( { 0=>:a, 1=>:b, 2=>:c }, a.to_hash )
35
- end
14
+ def test_to_h_arrayed
15
+ a = [[:a,1,2],[:b,3,4],[:c,5,6]]
16
+ assert_equal( { :a=>[1,2], :b=>[3,4], :c=>[5,6] }, a.to_h(true) )
17
+ end
36
18
 
19
+ def test_to_hash
20
+ a = [:a,:b,:c]
21
+ assert_equal( { 0=>:a, 1=>:b, 2=>:c }, a.to_hash )
37
22
  end
38
23
 
24
+ end
39
25
 
40
- class TestClassConversion < Test::Unit::TestCase
41
26
 
42
- Person = Struct.new(:name)
27
+ class TestClassConversion < Test::Unit::TestCase
43
28
 
44
- def test_to_proc
45
- people = ["joe"].map(&Person)
46
- assert_equal("joe", people[0].name)
47
- end
29
+ Person = Struct.new(:name)
48
30
 
31
+ def test_to_proc
32
+ people = ["joe"].map(&Person)
33
+ assert_equal("joe", people[0].name)
49
34
  end
50
35
 
36
+ end
51
37
 
52
- class TestEnumerableConversion < Test::Unit::TestCase
53
38
 
54
- def test_to_hash
55
- a = [:a,:b,:c]
56
- assert_equal( { 0=>:a, 1=>:b, 2=>:c }, a.to_hash )
57
- end
39
+ class TestEnumerableConversion < Test::Unit::TestCase
58
40
 
59
- def test_to_h
60
- a = [[1,:a],[2,:b],[3,:c]]
61
- assert_equal( { 1=>:a, 2=>:b, 3=>:c }, a.to_h )
62
- end
41
+ def test_to_hash
42
+ a = [:a,:b,:c]
43
+ assert_equal( { 0=>:a, 1=>:b, 2=>:c }, a.to_hash )
44
+ end
63
45
 
46
+ def test_to_h
47
+ a = [[1,:a],[2,:b],[3,:c]]
48
+ assert_equal( { 1=>:a, 2=>:b, 3=>:c }, a.to_h )
64
49
  end
65
50
 
51
+ end
66
52
 
67
- class TestHashConversion < Test::Unit::TestCase
68
53
 
69
- def test_to_h
70
- a = { :a => 1, :b => 2, :c => 3 }
71
- assert_equal( a, a.to_h )
72
- end
54
+ class TestHashConversion < Test::Unit::TestCase
73
55
 
56
+ def test_to_h
57
+ a = { :a => 1, :b => 2, :c => 3 }
58
+ assert_equal( a, a.to_h )
74
59
  end
75
60
 
61
+ end
76
62
 
77
- class TestNilClassConversion < Test::Unit::TestCase
78
-
79
- def test_to_f
80
- assert_equal( 0, nil.to_f )
81
- end
82
63
 
83
- def test_to_h
84
- assert_equal( {}, nil.to_h )
85
- end
64
+ class TestNilClassConversion < Test::Unit::TestCase
86
65
 
66
+ def test_to_f
67
+ assert_equal( 0, nil.to_f )
87
68
  end
88
69
 
70
+ def test_to_h
71
+ assert_equal( {}, nil.to_h )
72
+ end
89
73
 
90
- class TestRangeConversion < Test::Unit::TestCase
74
+ end
91
75
 
92
- def test_to_r
93
- a = (0..10)
94
- assert_equal( a, a.to_r )
95
- end
96
76
 
97
- def test_to_range
98
- a = (0..10)
99
- assert_equal( a, a.to_range )
100
- end
77
+ class TestRangeConversion < Test::Unit::TestCase
101
78
 
79
+ def test_to_r
80
+ a = (0..10)
81
+ assert_equal( a, a.to_r )
102
82
  end
103
83
 
84
+ def test_to_range
85
+ a = (0..10)
86
+ assert_equal( a, a.to_range )
87
+ end
104
88
 
105
- class TestRegexpConversion < Test::Unit::TestCase
89
+ end
106
90
 
107
- def test_to_re
108
- r = /0..10/
109
- assert_equal( r, r.to_re )
110
- end
111
91
 
112
- def test_to_regexp
113
- r = /0..10/
114
- assert_equal( r, r.to_regexp )
115
- end
92
+ class TestRegexpConversion < Test::Unit::TestCase
116
93
 
94
+ def test_to_re
95
+ r = /0..10/
96
+ assert_equal( r, r.to_re )
117
97
  end
118
98
 
99
+ def test_to_regexp
100
+ r = /0..10/
101
+ assert_equal( r, r.to_regexp )
102
+ end
119
103
 
120
- class TestStringConversion < Test::Unit::TestCase
121
-
122
- TestConst = 4
104
+ end
123
105
 
124
- def test_to_const
125
- assert_equal( 4, "TestStringConversion::TestConst".to_const )
126
- end
127
106
 
128
- def test_to_date
129
- s = "2005-10-31"
130
- d = s.to_date
131
- assert_equal( 31, d.day )
132
- assert_equal( 10, d.month )
133
- assert_equal( 2005, d.year )
134
- end
107
+ class TestStringConversion < Test::Unit::TestCase
135
108
 
136
- def test_to_time
137
- s = "2:31:15 PM"
138
- t = s.to_time
139
- assert_equal( 14, t.hour )
140
- assert_equal( 31, t.min )
141
- assert_equal( 15, t.sec )
142
- end
109
+ TestConst = 4
143
110
 
144
- def test_to_re
145
- assert_equal( /abc/, "abc".to_re )
146
- assert_equal( /a\+bc/, "a+bc".to_re )
147
- assert_equal( /a+bc/, "a+bc".to_re(false) )
148
- end
111
+ def test_to_const
112
+ assert_equal( 4, "TestStringConversion::TestConst".to_const )
113
+ end
149
114
 
150
- def test_to_proc
151
- assert_nothing_raised { @add = '|x,y| x + y'.to_proc }
152
- assert_equal(4, @add.call(2,2))
153
- @t = 3
154
- @multi = '|y| @t * y'.to_proc(self)
155
- assert_equal(6, @multi.call(2))
156
- x = 4
157
- @div = '|y| x / y'.to_proc(binding)
158
- assert_equal(2, @div.call(2))
159
- end
115
+ def test_to_date
116
+ s = "2005-10-31"
117
+ d = s.to_date
118
+ assert_equal( 31, d.day )
119
+ assert_equal( 10, d.month )
120
+ assert_equal( 2005, d.year )
121
+ end
160
122
 
161
- #def test_to_a
162
- # arr = 'abc'
163
- # assert_equal( ['a','b','c'], arr.to_a )
164
- #end
123
+ def test_to_time
124
+ s = "2:31:15 PM"
125
+ t = s.to_time
126
+ assert_equal( 14, t.hour )
127
+ assert_equal( 31, t.min )
128
+ assert_equal( 15, t.sec )
129
+ end
165
130
 
131
+ def test_to_re
132
+ assert_equal( /abc/, "abc".to_re )
133
+ assert_equal( /a\+bc/, "a+bc".to_re )
134
+ assert_equal( /a+bc/, "a+bc".to_re(false) )
166
135
  end
167
136
 
137
+ def test_to_proc
138
+ assert_nothing_raised { @add = '|x,y| x + y'.to_proc }
139
+ assert_equal(4, @add.call(2,2))
140
+ @t = 3
141
+ @multi = '|y| @t * y'.to_proc(self)
142
+ assert_equal(6, @multi.call(2))
143
+ x = 4
144
+ @div = '|y| x / y'.to_proc(binding)
145
+ assert_equal(2, @div.call(2))
146
+ end
168
147
 
169
- class TestSymbolConversion < Test::Unit::TestCase
148
+ #def test_to_a
149
+ # arr = 'abc'
150
+ # assert_equal( ['a','b','c'], arr.to_a )
151
+ #end
170
152
 
171
- TESTCONST = 1
153
+ end
172
154
 
173
- def test_to_const
174
- assert_equal( 1, :"TestSymbolConversion::TESTCONST".to_const )
175
- end
176
155
 
177
- def test_proc_01
178
- assert_instance_of(Proc, up = :upcase.to_proc )
179
- assert_equal( "HELLO", up.call("hello") )
180
- end
156
+ class TestSymbolConversion < Test::Unit::TestCase
181
157
 
182
- def test_proc_02
183
- q = [[1,2,3], [4,5,6], [7,8,9]].map(&:reverse)
184
- a = [[3, 2, 1], [6, 5, 4], [9, 8, 7]]
185
- assert_equal( a, q )
186
- end
158
+ TESTCONST = 1
187
159
 
188
- # Deprecated b/c of very strange issues.
160
+ def test_to_const
161
+ assert_equal( 1, :"TestSymbolConversion::TESTCONST".to_const )
162
+ end
189
163
 
190
- #def test_to_str
191
- # assert_equal( "a", :a.to_str )
192
- # assert_equal( "abc", :abc.to_str )
193
- # assert_equal( '#$%', :'#$%'.to_str )
194
- #end
164
+ def test_proc_01
165
+ assert_instance_of(Proc, up = :upcase.to_proc )
166
+ assert_equal( "HELLO", up.call("hello") )
167
+ end
195
168
 
169
+ def test_proc_02
170
+ q = [[1,2,3], [4,5,6], [7,8,9]].map(&:reverse)
171
+ a = [[3, 2, 1], [6, 5, 4], [9, 8, 7]]
172
+ assert_equal( a, q )
196
173
  end
197
174
 
175
+ # Deprecated b/c of very strange issues.
198
176
 
199
- require 'time'
177
+ #def test_to_str
178
+ # assert_equal( "a", :a.to_str )
179
+ # assert_equal( "abc", :abc.to_str )
180
+ # assert_equal( '#$%', :'#$%'.to_str )
181
+ #end
200
182
 
201
- class TestTimeConversion < Test::Unit::TestCase
183
+ end
202
184
 
203
- def setup
204
- @t = Time.parse('4/20/2005 15:37')
205
- end
206
185
 
207
- # TODO Problem with TIMEZONE.
186
+ require 'time'
208
187
 
209
- #def test_stamp_01
210
- # assert_equal( "Wed Apr 20 15:37:00 PDT 2005", @t.stamp )
211
- #end
188
+ class TestTimeConversion < Test::Unit::TestCase
212
189
 
213
- def test_stamp_02
214
- assert_equal( "April 20, 2005 15:37", @t.stamp(:long) )
215
- end
190
+ def setup
191
+ @t = Time.parse('4/20/2005 15:37')
192
+ end
216
193
 
217
- def test_stamp_03
218
- assert_equal( "20 Apr 15:37", @t.stamp(:short) )
219
- end
194
+ # TODO Problem with TIMEZONE.
220
195
 
221
- def test_to_date
222
- assert_instance_of( ::Date, @t.to_date )
223
- end
196
+ #def test_stamp_01
197
+ # assert_equal( "Wed Apr 20 15:37:00 PDT 2005", @t.stamp )
198
+ #end
224
199
 
225
- #def test_to_s
226
- # assert_equal( "Wed Apr 20 15:37:00 PDT 2005", @t.to_s )
227
- #end
200
+ def test_stamp_02
201
+ assert_equal( "April 20, 2005 15:37", @t.stamp(:long) )
202
+ end
228
203
 
229
- def test_to_time
230
- assert_instance_of( ::Time, @t.to_time )
231
- end
204
+ def test_stamp_03
205
+ assert_equal( "20 Apr 15:37", @t.stamp(:short) )
206
+ end
232
207
 
208
+ def test_to_date
209
+ assert_instance_of( ::Date, @t.to_date )
233
210
  end
234
211
 
212
+ #def test_to_s
213
+ # assert_equal( "Wed Apr 20 15:37:00 PDT 2005", @t.to_s )
214
+ #end
235
215
 
216
+ def test_to_time
217
+ assert_instance_of( ::Time, @t.to_time )
218
+ end
236
219
 
220
+ end