facets 2.1.2 → 2.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,19 +1,6 @@
1
- # _____ _
2
- # |_ _|__ ___| |_
3
- # | |/ _ \/ __| __|
4
- # | | __/\__ \ |
5
- # |_|\___||___/\__|
6
- #
7
- # for lib/facets/syncarray.rb
8
- #
9
- # Extracted Mon Sep 03 16:23:08 -0700 2007
10
- # w/ Test Extraction Ratchet
11
- #
12
-
13
- require 'facets/syncarray.rb'
14
-
15
-
1
+ # Test facets/syncarray.rb
16
2
 
3
+ require 'facets/syncarray.rb'
17
4
  require 'test/unit'
18
5
 
19
6
  # TODO
@@ -1,30 +1,18 @@
1
- # _____ _
2
- # |_ _|__ ___| |_
3
- # | |/ _ \/ __| __|
4
- # | | __/\__ \ |
5
- # |_|\___||___/\__|
6
- #
7
- # for lib/facets/synchash.rb
8
- #
9
- # Extracted Mon Sep 03 16:23:08 -0700 2007
10
- # w/ Test Extraction Ratchet
11
- #
12
-
13
- require 'facets/synchash.rb'
14
-
15
-
16
-
17
- require 'test/unit'
18
-
19
- # TODO
20
-
21
- class TC_SyncHash < Test::Unit::TestCase
22
-
23
- def test_01
24
- assert_nothing_raised{ @h = SyncHash.new }
25
- end
26
-
27
- end
28
-
1
+ # Test facets/synchash.rb
2
+
3
+ require 'facets/synchash.rb'
4
+
5
+ require 'test/unit'
6
+
7
+ # TODO
8
+
9
+ class TC_SyncHash < Test::Unit::TestCase
10
+
11
+ def test_01
12
+ assert_nothing_raised{ @h = SyncHash.new }
13
+ end
14
+
15
+ end
16
+
29
17
 
30
18
 
@@ -1,18 +1,6 @@
1
- # _____ _
2
- # |_ _|__ ___| |_
3
- # | |/ _ \/ __| __|
4
- # | | __/\__ \ |
5
- # |_|\___||___/\__|
6
- #
7
- # for lib/facets/timer.rb
8
- #
9
- # Extracted Mon Sep 03 16:23:08 -0700 2007
10
- # w/ Test Extraction Ratchet
11
- #
12
-
13
- require 'facets/timer.rb'
14
-
1
+ # Test facets/timer.rb
15
2
 
3
+ require 'facets/timer.rb'
16
4
 
17
5
  require 'test/unit'
18
6
 
@@ -1,105 +1,89 @@
1
- # _____ _
2
- # |_ _|__ ___| |_
3
- # | |/ _ \/ __| __|
4
- # | | __/\__ \ |
5
- # |_|\___||___/\__|
6
- #
7
- # for lib/facets/times.rb
8
- #
9
- # Extracted Mon Sep 03 16:23:08 -0700 2007
10
- # w/ Test Extraction Ratchet
11
- #
1
+ # Test facets/times.rb
12
2
 
13
- require 'facets/times.rb'
3
+ require 'facets/times.rb'
4
+ require 'test/unit'
5
+ #require 'mega/multiplier'
14
6
 
7
+ class NumericTest < Test::Unit::TestCase
15
8
 
9
+ #def test_micro_seconds
10
+ # assert_equal( 0.000001, 1.microsecond )
11
+ #end
16
12
 
17
- require 'test/unit'
18
- #require 'mega/multiplier'
13
+ #def test_milli_seconds
14
+ # assert_equal( 0.001, 1.millisecond )
15
+ #end
19
16
 
20
- class NumericTest < Test::Unit::TestCase
21
-
22
- #def test_micro_seconds
23
- # assert_equal( 0.000001, 1.microsecond )
24
- #end
25
-
26
- #def test_milli_seconds
27
- # assert_equal( 0.001, 1.millisecond )
28
- #end
29
-
30
- def test_seconds
31
- assert_equal( 60**0, 1.seconds )
32
- end
33
-
34
- def test_minutes
35
- assert_equal( 60**1, 1.minutes )
36
- end
37
-
38
- def test_hours
39
- assert_equal( 60**2, 1.hours )
40
- end
41
-
42
- def test_days
43
- assert_equal( 24*(60**2), 1.days )
44
- end
17
+ def test_seconds
18
+ assert_equal( 60**0, 1.seconds )
19
+ end
45
20
 
46
- def test_weeks
47
- assert_equal( 7*24*(60**2), 1.weeks )
48
- end
21
+ def test_minutes
22
+ assert_equal( 60**1, 1.minutes )
23
+ end
49
24
 
50
- def test_fortnights
51
- assert_equal( 14*24*(60**2), 1.fortnights )
52
- end
25
+ def test_hours
26
+ assert_equal( 60**2, 1.hours )
27
+ end
53
28
 
54
- def test_months
55
- assert_equal( 30*24*(60**2), 1.months )
56
- end
29
+ def test_days
30
+ assert_equal( 24*(60**2), 1.days )
31
+ end
57
32
 
58
- def test_years
59
- assert_equal( 365*24*(60**2), 1.years )
60
- end
33
+ def test_weeks
34
+ assert_equal( 7*24*(60**2), 1.weeks )
35
+ end
61
36
 
62
- def test_before
63
- t = Time.now
64
- assert_equal( t - 1.day, 1.day.before(t) )
65
- end
37
+ def test_fortnights
38
+ assert_equal( 14*24*(60**2), 1.fortnights )
39
+ end
66
40
 
67
- def test_after
68
- t = Time.now
69
- assert_equal( t + 1.day, 1.day.after(t) )
70
- end
41
+ def test_months
42
+ assert_equal( 30*24*(60**2), 1.months )
43
+ end
71
44
 
45
+ def test_years
46
+ assert_equal( 365*24*(60**2), 1.years )
72
47
  end
73
48
 
74
- class WeekdaysTest < Test::Unit::TestCase
49
+ def test_before
50
+ t = Time.now
51
+ assert_equal( t - 1.day, 1.day.before(t) )
52
+ end
75
53
 
76
- MONDAY = Time.at(1165250000)
77
- THURSDAY = Time.at(1165500000)
78
- FRIDAY = Time.at(1165606025)
54
+ def test_after
55
+ t = Time.now
56
+ assert_equal( t + 1.day, 1.day.after(t) )
57
+ end
79
58
 
80
- def test_weekday_after_monday
81
- assert_equal 2, 1.weekday.since(MONDAY).wday
82
- end
59
+ end
83
60
 
84
- def test_weekday_after_friday
85
- assert_equal 1, 1.weekday.after(FRIDAY).wday
86
- end
61
+ class WeekdaysTest < Test::Unit::TestCase
87
62
 
88
- def test_weekdays_before_friday
89
- assert_equal 2, 3.weekdays.before(FRIDAY).wday
90
- end
63
+ MONDAY = Time.at(1165250000)
64
+ THURSDAY = Time.at(1165500000)
65
+ FRIDAY = Time.at(1165606025)
91
66
 
92
- #def test_weekday_before_today
93
- # Time.expects(:now).returns(THURSDAY)
94
- # assert_equal 3, 1.weekday.ago.wday
95
- #end
67
+ def test_weekday_after_monday
68
+ assert_equal 2, 1.weekday.since(MONDAY).wday
69
+ end
96
70
 
97
- #def test_weekdays_after_today
98
- # Time.expects(:now).returns(MONDAY)
99
- # assert_equal 3, 2.weekday.from_now.wday
100
- #end
71
+ def test_weekday_after_friday
72
+ assert_equal 1, 1.weekday.after(FRIDAY).wday
73
+ end
101
74
 
75
+ def test_weekdays_before_friday
76
+ assert_equal 2, 3.weekdays.before(FRIDAY).wday
102
77
  end
103
78
 
79
+ #def test_weekday_before_today
80
+ # Time.expects(:now).returns(THURSDAY)
81
+ # assert_equal 3, 1.weekday.ago.wday
82
+ #end
104
83
 
84
+ #def test_weekdays_after_today
85
+ # Time.expects(:now).returns(MONDAY)
86
+ # assert_equal 3, 2.weekday.from_now.wday
87
+ #end
105
88
 
89
+ end
@@ -1,66 +1,50 @@
1
- # _____ _
2
- # |_ _|__ ___| |_
3
- # | |/ _ \/ __| __|
4
- # | | __/\__ \ |
5
- # |_|\___||___/\__|
6
- #
7
- # for lib/facets/tuple.rb
8
- #
9
- # Extracted Mon Sep 03 16:23:08 -0700 2007
10
- # w/ Test Extraction Ratchet
11
- #
1
+ # Test facets/tuple.rb
12
2
 
13
- require 'facets/tuple.rb'
3
+ require 'facets/tuple.rb'
4
+ require 'test/unit'
14
5
 
6
+ class TC_Tuple < Test::Unit::TestCase
15
7
 
8
+ def test_01
9
+ t1 = Tuple[1,2,3]
10
+ t2 = Tuple[2,4,5]
11
+ assert( t1 < t2 )
12
+ assert( t2 > t1 )
13
+ end
16
14
 
17
- require 'test/unit'
18
-
19
- class TC_Tuple < Test::Unit::TestCase
20
-
21
- def test_01
22
- t1 = Tuple[1,2,3]
23
- t2 = Tuple[2,4,5]
24
- assert( t1 < t2 )
25
- assert( t2 > t1 )
26
- end
27
-
28
- def test_02
29
- t1 = Tuple[1,2,3]
30
- a1 = t1.to_a
31
- assert( Array === a1 )
32
- end
33
-
34
- def test_03
35
- t1 = Tuple[1,2,3]
36
- t2 = Tuple[1,2,3]
37
- assert( t1.object_id === t2.object_id )
38
- end
39
-
40
- def test_04
41
- t1 = Tuple[1,2,3]
42
- t1 = t1 << 4
43
- assert( Tuple === t1 )
44
- t2 = Tuple[1,2,3,4]
45
- assert( t1.object_id == t2.object_id )
46
- end
47
-
48
- def test_05
49
- t1 = "1.2.3".to_t
50
- assert( Tuple === t1 )
51
- t2 = Tuple[1,2,3]
52
- assert( t1.object_id == t2.object_id )
53
- end
15
+ def test_02
16
+ t1 = Tuple[1,2,3]
17
+ a1 = t1.to_a
18
+ assert( Array === a1 )
19
+ end
54
20
 
55
- def test_06
56
- t1 = "1.2.3a".to_t
57
- assert( Tuple === t1 )
58
- t2 = Tuple[1,2,'3a']
59
- assert_equal( t2, t1 )
60
- assert( t2.object_id == t1.object_id )
61
- end
21
+ def test_03
22
+ t1 = Tuple[1,2,3]
23
+ t2 = Tuple[1,2,3]
24
+ assert( t1.object_id === t2.object_id )
25
+ end
62
26
 
27
+ def test_04
28
+ t1 = Tuple[1,2,3]
29
+ t1 = t1 << 4
30
+ assert( Tuple === t1 )
31
+ t2 = Tuple[1,2,3,4]
32
+ assert( t1.object_id == t2.object_id )
63
33
  end
64
34
 
35
+ def test_05
36
+ t1 = "1.2.3".to_t
37
+ assert( Tuple === t1 )
38
+ t2 = Tuple[1,2,3]
39
+ assert( t1.object_id == t2.object_id )
40
+ end
65
41
 
42
+ def test_06
43
+ t1 = "1.2.3a".to_t
44
+ assert( Tuple === t1 )
45
+ t2 = Tuple[1,2,'3a']
46
+ assert_equal( t2, t1 )
47
+ assert( t2.object_id == t1.object_id )
48
+ end
66
49
 
50
+ end
@@ -1,20 +1,10 @@
1
- # _____ _
2
- # |_ _|__ ___| |_
3
- # | |/ _ \/ __| __|
4
- # | | __/\__ \ |
5
- # |_|\___||___/\__|
6
- #
7
- # for lib/facets/typecast.rb
8
- #
9
- # Extracted Mon Sep 03 16:23:08 -0700 2007
10
- # w/ Test Extraction Ratchet
11
- #
1
+ # Test facets/typecast.rb
12
2
 
13
- require 'facets/typecast.rb'
3
+ require 'facets/typecast.rb'
14
4
 
5
+ require 'test/unit'
15
6
 
16
-
17
- require 'test/unit'
7
+ class TC_TypeCast < Test::Unit::TestCase
18
8
 
19
9
  class TestClass
20
10
  attr_accessor :my_var
@@ -31,40 +21,39 @@
31
21
  end
32
22
  end
33
23
 
34
- class TC_TypeCast < Test::Unit::TestCase
35
24
 
36
- def setup
37
- @test_string = "this is a test"
38
- @test_class = TestClass.new(@test_string)
39
- end
25
+ def setup
26
+ @test_string = "this is a test"
27
+ @test_class = TestClass.new(@test_string)
28
+ end
40
29
 
41
- def test_to_string
42
- assert_equal( '1234', 1234.cast_to(String) )
43
- end
30
+ def test_to_string
31
+ assert_equal( '1234', 1234.cast_to(String) )
32
+ end
44
33
 
45
- def test_custom_to_string
46
- assert_equal( @test_string, @test_class.cast_to(String) )
47
- end
34
+ def test_custom_to_string
35
+ assert_equal( @test_string, @test_class.cast_to(String) )
36
+ end
48
37
 
49
- def test_custom_from_string
50
- assert_equal( @test_class.my_var, @test_string.cast_to(TestClass).my_var )
51
- end
38
+ def test_custom_from_string
39
+ assert_equal( @test_class.my_var, @test_string.cast_to(TestClass).my_var )
40
+ end
52
41
 
53
- def test_string_to_class
54
- assert_equal( Test::Unit::TestCase, "Test::Unit::TestCase".cast_to(Class) )
55
- end
42
+ def test_string_to_class
43
+ assert_equal( Test::Unit::TestCase, "Test::Unit::TestCase".cast_to(Class) )
44
+ end
56
45
 
57
- def test_string_to_time
58
- assert_equal( "Mon Oct 10 00:00:00 2005", "2005-10-10".cast_to(Time).strftime("%a %b %d %H:%M:%S %Y") )
59
- end
46
+ def test_string_to_time
47
+ assert_equal( "Mon Oct 10 00:00:00 2005", "2005-10-10".cast_to(Time).strftime("%a %b %d %H:%M:%S %Y") )
48
+ end
60
49
 
61
- def test_no_converter
62
- "sfddsf".cast_to( ::Regexp )
63
- assert(1+1==3, 'should not get here')
64
- rescue TypeCastException => ex
65
- assert_equal(TypeCastException, ex.class)
66
- end
50
+ def test_no_converter
51
+ "sfddsf".cast_to( ::Regexp )
52
+ assert(1+1==3, 'should not get here')
53
+ rescue TypeCastException => ex
54
+ assert_equal(TypeCastException, ex.class)
67
55
  end
56
+ end
68
57
 
69
58
 
70
59