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,128 +1,112 @@
1
- # _____ _
2
- # |_ _|__ ___| |_
3
- # | |/ _ \/ __| __|
4
- # | | __/\__ \ |
5
- # |_|\___||___/\__|
6
- #
7
- # for lib/facets/openobject.rb
8
- #
9
- # Extracted Mon Sep 03 16:23:07 -0700 2007
10
- # w/ Test Extraction Ratchet
11
- #
12
-
13
- require 'facets/openobject.rb'
14
-
15
-
16
-
17
- require 'test/unit'
18
-
19
- class TestOpenObject1 < Test::Unit::TestCase
20
-
21
- def test_1_01
22
- o = OpenObject.new
23
- assert( o.respond_to?(:key?) )
24
- end
25
-
26
- def test_1_02
27
- assert_instance_of( OpenObject, OpenObject[{}] )
28
- end
29
-
30
- def test_1_03
31
- f0 = OpenObject.new
32
- f0[:a] = 1
33
- #assert_equal( [1], f0.to_a )
34
- assert_equal( {:a=>1}, f0.to_h )
35
- end
36
-
37
- def test_1_04
38
- f0 = OpenObject[:a=>1]
39
- f0[:b] = 2
40
- assert_equal( {:a=>1,:b=>2}, f0.to_h )
41
- end
42
-
43
- def test_1_05
44
- f0 = OpenObject[:class=>1]
45
- assert_equal( 1, f0.class )
46
- end
1
+ # Test facets/openobject.rb
2
+
3
+ require 'facets/openobject.rb'
4
+ require 'test/unit'
5
+
6
+ class TestOpenObject1 < Test::Unit::TestCase
7
+
8
+ def test_1_01
9
+ o = OpenObject.new
10
+ assert( o.respond_to?(:key?) )
11
+ end
12
+
13
+ def test_1_02
14
+ assert_instance_of( OpenObject, OpenObject[{}] )
15
+ end
16
+
17
+ def test_1_03
18
+ f0 = OpenObject.new
19
+ f0[:a] = 1
20
+ #assert_equal( [1], f0.to_a )
21
+ assert_equal( {:a=>1}, f0.to_h )
47
22
  end
48
23
 
49
- class TestOpenObject2 < Test::Unit::TestCase
50
-
51
- def test_2_01
52
- f0 = OpenObject[:f0=>"f0"]
53
- h0 = { :h0=>"h0" }
54
- assert_equal( OpenObject[:f0=>"f0", :h0=>"h0"], f0.send(:merge,h0) )
55
- assert_equal( {:f0=>"f0", :h0=>"h0"}, h0.merge( f0 ) )
56
- end
57
-
58
- def test_2_02
59
- f1 = OpenObject[:f1=>"f1"]
60
- h1 = { :h1=>"h1" }
61
- f1.send(:update,h1)
62
- h1.update( f1 )
63
- assert_equal( OpenObject[:f1=>"f1", :h1=>"h1"], f1 )
64
- assert_equal( {:f1=>"f1", :h1=>"h1"}, h1 )
65
- end
66
-
67
- def test_2_03
68
- o = OpenObject[:a=>1,:b=>{:x=>9}]
69
- assert_equal( 9, o[:b][:x] )
70
- assert_equal( 9, o.b[:x] )
71
- end
72
-
73
- def test_2_04
74
- o = OpenObject["a"=>1,"b"=>{:x=>9}]
75
- assert_equal( 1, o["a"] )
76
- assert_equal( 1, o[:a] )
77
- assert_equal( {:x=>9}, o["b"] )
78
- assert_equal( {:x=>9}, o[:b] )
79
- assert_equal( 9, o["b"][:x] )
80
- assert_equal( nil, o[:b]["x"] )
81
- end
24
+ def test_1_04
25
+ f0 = OpenObject[:a=>1]
26
+ f0[:b] = 2
27
+ assert_equal( {:a=>1,:b=>2}, f0.to_h )
28
+ end
82
29
 
30
+ def test_1_05
31
+ f0 = OpenObject[:class=>1]
32
+ assert_equal( 1, f0.class )
83
33
  end
34
+ end
84
35
 
85
- class TestOpenObject3 < Test::Unit::TestCase
86
- def test_3_01
87
- fo = OpenObject.new
88
- 9.times{ |i| fo.send( "n#{i}=", 1 ) }
89
- 9.times{ |i|
90
- assert_equal( 1, fo.send( "n#{i}" ) )
91
- }
92
- end
36
+ class TestOpenObject2 < Test::Unit::TestCase
37
+
38
+ def test_2_01
39
+ f0 = OpenObject[:f0=>"f0"]
40
+ h0 = { :h0=>"h0" }
41
+ assert_equal( OpenObject[:f0=>"f0", :h0=>"h0"], f0.send(:merge,h0) )
42
+ assert_equal( {:f0=>"f0", :h0=>"h0"}, h0.merge( f0 ) )
93
43
  end
94
44
 
95
- class TestOpenObject4 < Test::Unit::TestCase
45
+ def test_2_02
46
+ f1 = OpenObject[:f1=>"f1"]
47
+ h1 = { :h1=>"h1" }
48
+ f1.send(:update,h1)
49
+ h1.update( f1 )
50
+ assert_equal( OpenObject[:f1=>"f1", :h1=>"h1"], f1 )
51
+ assert_equal( {:f1=>"f1", :h1=>"h1"}, h1 )
52
+ end
96
53
 
97
- def test_4_01
98
- ho = {}
99
- fo = OpenObject.new
100
- 5.times{ |i| ho["n#{i}".to_sym]=1 }
101
- 5.times{ |i| fo.send( "n#{i}=", 1 ) }
102
- assert_equal(ho, fo.to_h)
103
- end
54
+ def test_2_03
55
+ o = OpenObject[:a=>1,:b=>{:x=>9}]
56
+ assert_equal( 9, o[:b][:x] )
57
+ assert_equal( 9, o.b[:x] )
58
+ end
104
59
 
60
+ def test_2_04
61
+ o = OpenObject["a"=>1,"b"=>{:x=>9}]
62
+ assert_equal( 1, o["a"] )
63
+ assert_equal( 1, o[:a] )
64
+ assert_equal( {:x=>9}, o["b"] )
65
+ assert_equal( {:x=>9}, o[:b] )
66
+ assert_equal( 9, o["b"][:x] )
67
+ assert_equal( nil, o[:b]["x"] )
105
68
  end
106
69
 
107
- class TestOpenObject5 < Test::Unit::TestCase
70
+ end
108
71
 
109
- def test_5_01
110
- p = lambda { |x|
111
- x.word = "Hello"
112
- }
113
- o = p.to_openobject
114
- assert_equal( "Hello", o.word )
115
- end
72
+ class TestOpenObject3 < Test::Unit::TestCase
73
+ def test_3_01
74
+ fo = OpenObject.new
75
+ 9.times{ |i| fo.send( "n#{i}=", 1 ) }
76
+ 9.times{ |i|
77
+ assert_equal( 1, fo.send( "n#{i}" ) )
78
+ }
79
+ end
80
+ end
116
81
 
117
- def test_5_02
118
- p = lambda { |x|
119
- x.word = "Hello"
120
- }
121
- o = OpenObject[:a=>1,:b=>2]
122
- assert_instance_of( Proc, o.to_proc )
123
- end
82
+ class TestOpenObject4 < Test::Unit::TestCase
124
83
 
84
+ def test_4_01
85
+ ho = {}
86
+ fo = OpenObject.new
87
+ 5.times{ |i| ho["n#{i}".to_sym]=1 }
88
+ 5.times{ |i| fo.send( "n#{i}=", 1 ) }
89
+ assert_equal(ho, fo.to_h)
125
90
  end
126
91
 
92
+ end
127
93
 
94
+ class TestOpenObject5 < Test::Unit::TestCase
95
+
96
+ def test_5_01
97
+ p = lambda { |x|
98
+ x.word = "Hello"
99
+ }
100
+ o = p.to_openobject
101
+ assert_equal( "Hello", o.word )
102
+ end
103
+
104
+ def test_5_02
105
+ p = lambda { |x|
106
+ x.word = "Hello"
107
+ }
108
+ o = OpenObject[:a=>1,:b=>2]
109
+ assert_instance_of( Proc, o.to_proc )
110
+ end
128
111
 
112
+ end
@@ -1,10 +1,4 @@
1
- # _____ _
2
- # |_ _|__ ___| |_
3
- # | |/ _ \/ __| __|
4
- # | | __/\__ \ |
5
- # |_|\___||___/\__|
6
- #
7
- # for lib/facets/ostruct.rb
1
+ # Test facets/ostruct.rb
8
2
 
9
3
  require 'facets/ostruct.rb'
10
4
  require 'test/unit'
@@ -1,9 +1,4 @@
1
- # _____ _
2
- # |_ _|__ ___| |_
3
- # | |/ _ \/ __| __|
4
- # | | __/\__ \ |
5
- # |_|\___||___/\__|
6
- #
1
+ # Test facets/overload.rb
7
2
 
8
3
  require 'facets/overload.rb'
9
4
 
@@ -1,10 +1,4 @@
1
- # _____ _
2
- # |_ _|__ ___| |_
3
- # | |/ _ \/ __| __|
4
- # | | __/\__ \ |
5
- # |_|\___||___/\__|
6
- #
7
- # for facets/paramix.rb
1
+ # Test facets/paramix.rb
8
2
 
9
3
  require 'facets/paramix.rb'
10
4
 
@@ -1,10 +1,4 @@
1
- # _____ _
2
- # |_ _|__ ___| |_
3
- # | |/ _ \/ __| __|
4
- # | | __/\__ \ |
5
- # |_|\___||___/\__|
6
- #
7
- # for facets/pp_s.rb
1
+ # Test facets/pp_s.rb
8
2
 
9
3
  require 'facets/pp_s.rb'
10
4
  require 'test/unit'
@@ -1,9 +1,4 @@
1
- # _____ _
2
- # |_ _|__ ___| |_
3
- # | |/ _ \/ __| __|
4
- # | | __/\__ \ |
5
- # |_|\___||___/\__|
6
- #
1
+ # Test facets/prototype.rb
7
2
 
8
3
  require 'facets/prototype.rb'
9
4
 
@@ -1,46 +1,31 @@
1
- # _____ _
2
- # |_ _|__ ___| |_
3
- # | |/ _ \/ __| __|
4
- # | | __/\__ \ |
5
- # |_|\___||___/\__|
6
- #
7
- # for lib/facets/recorder.rb
8
- #
9
- # Extracted Mon Sep 03 16:23:08 -0700 2007
10
- # w/ Test Extraction Ratchet
11
- #
1
+ # Test facets/recorder.rb
12
2
 
13
- require 'facets/recorder.rb'
3
+ require 'facets/recorder.rb'
14
4
 
5
+ require 'test/unit'
15
6
 
7
+ #class Object
8
+ # def &(o)
9
+ # self && o
10
+ # end
11
+ #end
16
12
 
17
- require 'test/unit'
18
-
19
- #class Object
20
- # def &(o)
21
- # self && o
22
- # end
23
- #end
24
-
25
- class TCRecorder < Test::Unit::TestCase
26
-
27
- class Z
28
- def name ; 'George' ; end
29
- def age ; 12 ; end
30
- end
31
-
32
- def setup
33
- @z = Z.new
34
- end
35
-
36
- def test_001
37
- r = Recorder.new
38
- q = proc { |x| (x.name == 'George') & (x.age > 10) }
39
- x = q[r]
40
- assert( x.__call__(@z) )
41
- end
13
+ class TCRecorder < Test::Unit::TestCase
42
14
 
15
+ class Z
16
+ def name ; 'George' ; end
17
+ def age ; 12 ; end
43
18
  end
44
19
 
20
+ def setup
21
+ @z = Z.new
22
+ end
45
23
 
24
+ def test_001
25
+ r = Recorder.new
26
+ q = proc { |x| (x.name == 'George') & (x.age > 10) }
27
+ x = q[r]
28
+ assert( x.__call__(@z) )
29
+ end
46
30
 
31
+ end
@@ -1,18 +1,6 @@
1
- # _____ _
2
- # |_ _|__ ___| |_
3
- # | |/ _ \/ __| __|
4
- # | | __/\__ \ |
5
- # |_|\___||___/\__|
6
- #
7
- # for lib/facets/snapshot.rb
8
- #
9
- # Extracted Mon Sep 03 16:23:08 -0700 2007
10
- # w/ Test Extraction Ratchet
11
- #
12
-
13
- require 'facets/snapshot.rb'
14
-
1
+ # Test lib/facets/snapshot.rb
15
2
 
3
+ require 'facets/snapshot.rb'
16
4
 
17
5
  require 'test/unit'
18
6
 
@@ -1,154 +1,140 @@
1
- # _____ _
2
- # |_ _|__ ___| |_
3
- # | |/ _ \/ __| __|
4
- # | | __/\__ \ |
5
- # |_|\___||___/\__|
6
- #
7
- # for lib/facets/stylize.rb
8
- #
9
- # Extracted Mon Sep 03 16:23:08 -0700 2007
10
- # w/ Test Extraction Ratchet
11
- #
12
-
13
- require 'facets/stylize.rb'
14
-
15
-
16
-
17
- require 'test/unit'
18
-
19
- class TestInflect < Test::Unit::TestCase
20
-
21
- def test_basename_01
22
- assert_equal( "Unit", "Test::Unit".basename )
23
- end
24
-
25
- def test_basename_02
26
- a = "Down::Bottom"
27
- assert_raises( ArgumentError ) { a.basename(1) }
28
- end
29
-
30
- def test_basename_03
31
- a = "Down::Bottom"
32
- assert_equal( "Bottom", a.basename )
33
- end
34
-
35
- def test_basename_04
36
- b = "Further::Down::Bottom"
37
- assert_equal( "Bottom", b.basename )
38
- end
39
-
40
- def test_camelize
41
- assert_equal( 'ThisIsIt', 'this_is_it'.camelize )
42
- end
43
-
44
- def test_camelcase
45
- assert_equal( "abcXyz", "abc_xyz".camelcase )
46
- assert_equal( "abcXyz", "abc xyz".camelcase )
47
- assert_equal( "abcXyz", "abc xyz".camelcase )
48
- assert_equal( "abcXyz", "abc\txyz".camelcase )
49
- assert_equal( "abcXyz", "abc\nxyz".camelcase )
50
- assert_equal( "abcXyz", "abc____xyz".camelcase )
51
- end
52
-
53
- def test_camelcase_true
54
- assert_equal( "AbcXyz", "abc_xyz".camelcase(true) )
55
- assert_equal( "AbcXyz", "abc xyz".camelcase(true) )
56
- assert_equal( "AbcXyz", "abc xyz".camelcase(true) )
57
- assert_equal( "AbcXyz", "abc\txyz".camelcase(true) )
58
- assert_equal( "AbcXyz", "abc\nxyz".camelcase(true) )
59
- end
1
+ # Test lib/facets/stylize.rb
60
2
 
61
- def test_humanize
62
- assert_equal( 'This is it', 'this_is_it'.humanize )
63
- end
3
+ require 'facets/stylize.rb'
64
4
 
65
- def test_title
66
- r = "try this out".title
67
- x = "Try This Out"
68
- assert_equal(x,r)
69
- end
5
+ require 'test/unit'
70
6
 
71
- def test_demodulize_01
72
- a = "Down::Bottom"
73
- assert_raises( ArgumentError ) { a.demodulize(1) }
74
- end
75
7
 
76
- def test_demodulize_02
77
- a = "Down::Bottom"
78
- assert_equal( "Bottom", a.demodulize )
79
- end
8
+ class TestStylize < Test::Unit::TestCase
80
9
 
81
- def test_demodulize_03
82
- b = "Further::Down::Bottom"
83
- assert_equal( "Bottom", b.demodulize )
84
- end
10
+ def test_basename_01
11
+ assert_equal( "Unit", "Test::Unit".basename )
12
+ end
85
13
 
86
- def test_demodulize_01
87
- a = "Down::Bottom"
88
- assert_raises( ArgumentError ) { a.demodulize(1) }
89
- end
14
+ def test_basename_02
15
+ a = "Down::Bottom"
16
+ assert_raises( ArgumentError ) { a.basename(1) }
17
+ end
90
18
 
91
- def test_demodulize_02
92
- a = "Down::Bottom"
93
- assert_equal( "Bottom", a.demodulize )
94
- end
19
+ def test_basename_03
20
+ a = "Down::Bottom"
21
+ assert_equal( "Bottom", a.basename )
22
+ end
95
23
 
96
- def test_demodulize_03
97
- b = "Further::Down::Bottom"
98
- assert_equal( "Bottom", b.demodulize )
99
- end
24
+ def test_basename_04
25
+ b = "Further::Down::Bottom"
26
+ assert_equal( "Bottom", b.basename )
27
+ end
100
28
 
101
- def test_methodize
102
- assert_equal( 'hello_world', 'HelloWorld'.methodize )
103
- assert_equal( '__unix_path', '/unix_path'.methodize )
104
- end
29
+ def test_camelize
30
+ assert_equal( 'ThisIsIt', 'this_is_it'.camelize )
31
+ end
105
32
 
106
- def test_modulize
107
- assert_equal( 'MyModule::MyClass', 'my_module__my_class'.modulize )
108
- assert_equal( '::MyModule::MyClass', '__my_module__my_class'.modulize )
109
- assert_equal( 'MyModule::MyClass', 'my_module/my_class'.modulize )
110
- assert_equal( '::MyModule::MyClass', '/my_module/my_class'.modulize )
111
- end
33
+ def test_camelcase
34
+ assert_equal( "abcXyz", "abc_xyz".camelcase )
35
+ assert_equal( "abcXyz", "abc xyz".camelcase )
36
+ assert_equal( "abcXyz", "abc xyz".camelcase )
37
+ assert_equal( "abcXyz", "abc\txyz".camelcase )
38
+ assert_equal( "abcXyz", "abc\nxyz".camelcase )
39
+ assert_equal( "abcXyz", "abc____xyz".camelcase )
40
+ end
112
41
 
113
- def test_pathize
114
- assert_equal( 'my_module/my_class', 'MyModule::MyClass'.pathize )
115
- assert_equal( 'u_r_i', 'URI'.pathize )
116
- assert_equal( '/my_class', '::MyClass'.pathize )
117
- assert_equal( '/my_module/my_class/', '/my_module/my_class/'.pathize )
118
- end
42
+ def test_camelcase_true
43
+ assert_equal( "AbcXyz", "abc_xyz".camelcase(true) )
44
+ assert_equal( "AbcXyz", "abc xyz".camelcase(true) )
45
+ assert_equal( "AbcXyz", "abc xyz".camelcase(true) )
46
+ assert_equal( "AbcXyz", "abc\txyz".camelcase(true) )
47
+ assert_equal( "AbcXyz", "abc\nxyz".camelcase(true) )
48
+ end
119
49
 
50
+ def test_humanize
51
+ assert_equal( 'This is it', 'this_is_it'.humanize )
120
52
  end
121
53
 
54
+ def test_title
55
+ r = "try this out".title
56
+ x = "Try This Out"
57
+ assert_equal(x,r)
58
+ end
122
59
 
123
- class TestClassInflect < Test::Unit::TestCase
60
+ def test_demodulize_01
61
+ a = "Down::Bottom"
62
+ assert_raises( ArgumentError ) { a.demodulize(1) }
63
+ end
124
64
 
125
- def test_method_name
126
- assert_equal( Test::Unit::TestCase.methodize, 'test__unit__test_case' )
127
- end
65
+ def test_demodulize_02
66
+ a = "Down::Bottom"
67
+ assert_equal( "Bottom", a.demodulize )
68
+ end
128
69
 
129
- def test_method_name
130
- assert_equal( Test::Unit::TestCase.pathize, '/test/unit/test_case' )
131
- end
70
+ def test_demodulize_03
71
+ b = "Further::Down::Bottom"
72
+ assert_equal( "Bottom", b.demodulize )
73
+ end
132
74
 
75
+ def test_demodulize_01
76
+ a = "Down::Bottom"
77
+ assert_raises( ArgumentError ) { a.demodulize(1) }
133
78
  end
134
79
 
135
- class TestIntegerInflect < Test::Unit::TestCase
80
+ def test_demodulize_02
81
+ a = "Down::Bottom"
82
+ assert_equal( "Bottom", a.demodulize )
83
+ end
136
84
 
137
- def test_ordinalize
138
- assert_equal( '1st', '1'.ordinalize )
139
- assert_equal( '2nd', '2'.ordinalize )
140
- assert_equal( '3rd', '3'.ordinalize )
141
- assert_equal( '4th', '4'.ordinalize )
142
- end
85
+ def test_demodulize_03
86
+ b = "Further::Down::Bottom"
87
+ assert_equal( "Bottom", b.demodulize )
88
+ end
143
89
 
144
- def test_ordinal
145
- assert_equal( '1st', 1.ordinal )
146
- assert_equal( '2nd', 2.ordinal )
147
- assert_equal( '3rd', 3.ordinal )
148
- assert_equal( '4th', 4.ordinal )
149
- end
90
+ def test_methodize
91
+ assert_equal( 'hello_world', 'HelloWorld'.methodize )
92
+ assert_equal( '__unix_path', '/unix_path'.methodize )
93
+ end
150
94
 
95
+ def test_modulize
96
+ assert_equal( 'MyModule::MyClass', 'my_module__my_class'.modulize )
97
+ assert_equal( '::MyModule::MyClass', '__my_module__my_class'.modulize )
98
+ assert_equal( 'MyModule::MyClass', 'my_module/my_class'.modulize )
99
+ assert_equal( '::MyModule::MyClass', '/my_module/my_class'.modulize )
151
100
  end
152
101
 
102
+ def test_pathize
103
+ assert_equal( 'my_module/my_class', 'MyModule::MyClass'.pathize )
104
+ assert_equal( 'u_r_i', 'URI'.pathize )
105
+ assert_equal( '/my_class', '::MyClass'.pathize )
106
+ assert_equal( '/my_module/my_class/', '/my_module/my_class/'.pathize )
107
+ end
108
+
109
+ end
110
+
111
+
112
+ class TestClassStylize < Test::Unit::TestCase
153
113
 
114
+ def test_method_name
115
+ assert_equal( Test::Unit::TestCase.methodize, 'test__unit__test_case' )
116
+ end
117
+
118
+ def test_method_name
119
+ assert_equal( Test::Unit::TestCase.pathize, '/test/unit/test_case' )
120
+ end
121
+
122
+ end
123
+
124
+ class TestIntegerStylize < Test::Unit::TestCase
125
+
126
+ def test_ordinalize
127
+ assert_equal( '1st', '1'.ordinalize )
128
+ assert_equal( '2nd', '2'.ordinalize )
129
+ assert_equal( '3rd', '3'.ordinalize )
130
+ assert_equal( '4th', '4'.ordinalize )
131
+ end
132
+
133
+ def test_ordinal
134
+ assert_equal( '1st', 1.ordinal )
135
+ assert_equal( '2nd', 2.ordinal )
136
+ assert_equal( '3rd', 3.ordinal )
137
+ assert_equal( '4th', 4.ordinal )
138
+ end
154
139
 
140
+ end