xqsr3 0.38.2 → 0.39.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +15 -6
  3. data/examples/count_word_frequencies.md +12 -12
  4. data/examples/count_word_frequencies.rb +4 -4
  5. data/lib/xqsr3/array_utilities/join_with_or.rb +47 -47
  6. data/lib/xqsr3/array_utilities.rb +2 -2
  7. data/lib/xqsr3/command_line_utilities/map_option_string.rb +60 -60
  8. data/lib/xqsr3/command_line_utilities.rb +2 -2
  9. data/lib/xqsr3/containers/frequency_map.rb +399 -399
  10. data/lib/xqsr3/containers/multi_map.rb +448 -448
  11. data/lib/xqsr3/containers.rb +3 -3
  12. data/lib/xqsr3/conversion/bool_parser.rb +51 -51
  13. data/lib/xqsr3/conversion/integer_parser.rb +87 -87
  14. data/lib/xqsr3/conversion.rb +3 -3
  15. data/lib/xqsr3/diagnostics/exception_utilities.rb +145 -145
  16. data/lib/xqsr3/diagnostics/exceptions/with_cause.rb +90 -90
  17. data/lib/xqsr3/diagnostics/inspect_builder.rb +80 -80
  18. data/lib/xqsr3/diagnostics.rb +3 -3
  19. data/lib/xqsr3/doc_.rb +130 -130
  20. data/lib/xqsr3/extensions/array/join_with_or.rb +9 -9
  21. data/lib/xqsr3/extensions/enumerable/collect_with_index.rb +12 -12
  22. data/lib/xqsr3/extensions/enumerable/detect_map.rb +35 -35
  23. data/lib/xqsr3/extensions/enumerable/unique.rb +29 -28
  24. data/lib/xqsr3/extensions/hash/deep_transform.rb +1 -1
  25. data/lib/xqsr3/extensions/hash/except.rb +16 -16
  26. data/lib/xqsr3/extensions/hash/has_match.rb +10 -10
  27. data/lib/xqsr3/extensions/hash/match.rb +10 -10
  28. data/lib/xqsr3/extensions/hash/slice.rb +11 -11
  29. data/lib/xqsr3/extensions/hash.rb +1 -1
  30. data/lib/xqsr3/extensions/integer/to_s_grp.rb +118 -0
  31. data/lib/xqsr3/extensions/integer.rb +3 -0
  32. data/lib/xqsr3/extensions/io/writelines.rb +28 -28
  33. data/lib/xqsr3/extensions/kernel/integer.rb +20 -20
  34. data/lib/xqsr3/extensions/kernel/raise_with_options.rb +8 -8
  35. data/lib/xqsr3/extensions/kernel.rb +1 -0
  36. data/lib/xqsr3/extensions/string/ends_with.rb +1 -1
  37. data/lib/xqsr3/extensions/string/map_option_string.rb +4 -4
  38. data/lib/xqsr3/extensions/string/nil_if_empty.rb +1 -1
  39. data/lib/xqsr3/extensions/string/nil_if_whitespace.rb +1 -1
  40. data/lib/xqsr3/extensions/string/quote_if.rb +1 -1
  41. data/lib/xqsr3/extensions/string/starts_with.rb +1 -1
  42. data/lib/xqsr3/extensions/string/to_bool.rb +8 -8
  43. data/lib/xqsr3/extensions/string/to_symbol.rb +1 -1
  44. data/lib/xqsr3/extensions/string/truncate.rb +1 -1
  45. data/lib/xqsr3/extensions/test/unit/assert_eql.rb +10 -7
  46. data/lib/xqsr3/extensions/test/unit/assert_false.rb +9 -6
  47. data/lib/xqsr3/extensions/test/unit/assert_not.rb +9 -6
  48. data/lib/xqsr3/extensions/test/unit/assert_not_eql.rb +10 -7
  49. data/lib/xqsr3/extensions/test/unit/assert_raise_with_message.rb +61 -61
  50. data/lib/xqsr3/extensions/test/unit/assert_subclass_of.rb +10 -7
  51. data/lib/xqsr3/extensions/test/unit/assert_superclass_of.rb +10 -7
  52. data/lib/xqsr3/extensions/test/unit/assert_true.rb +9 -6
  53. data/lib/xqsr3/extensions/test/unit/assert_type_has_instance_methods.rb +39 -36
  54. data/lib/xqsr3/extensions.rb +5 -5
  55. data/lib/xqsr3/hash_utilities/deep_transform.rb +65 -65
  56. data/lib/xqsr3/hash_utilities/key_matching.rb +77 -77
  57. data/lib/xqsr3/hash_utilities.rb +3 -3
  58. data/lib/xqsr3/internal_/test_unit_version_.rb +83 -83
  59. data/lib/xqsr3/io/writelines.rb +122 -120
  60. data/lib/xqsr3/quality/parameter_checking.rb +445 -445
  61. data/lib/xqsr3/quality.rb +2 -2
  62. data/lib/xqsr3/string_utilities/ends_with.rb +59 -59
  63. data/lib/xqsr3/string_utilities/nil_if_empty.rb +28 -28
  64. data/lib/xqsr3/string_utilities/nil_if_whitespace.rb +29 -29
  65. data/lib/xqsr3/string_utilities/quote_if.rb +50 -50
  66. data/lib/xqsr3/string_utilities/starts_with.rb +59 -59
  67. data/lib/xqsr3/string_utilities/to_symbol.rb +75 -75
  68. data/lib/xqsr3/string_utilities/truncate.rb +55 -55
  69. data/lib/xqsr3/string_utilities.rb +8 -8
  70. data/lib/xqsr3/version.rb +12 -12
  71. data/test/performance/frequency_map.rb +12 -12
  72. data/test/scratch/test_assert_raise_with_message.rb +11 -11
  73. data/test/unit/array_utilities/tc_join_with_or.rb +140 -140
  74. data/test/unit/command_line_utilities/tc_map_option_string.rb +18 -18
  75. data/test/unit/containers/tc_frequency_map.rb +591 -591
  76. data/test/unit/containers/tc_multi_map.rb +558 -558
  77. data/test/unit/conversion/tc_integer_parser.rb +72 -72
  78. data/test/unit/conversion/tc_to_bool.rb +25 -25
  79. data/test/unit/diagnostics/exceptions/tc_with_cause.rb +165 -165
  80. data/test/unit/diagnostics/tc_exception_utilities.rb +156 -156
  81. data/test/unit/extensions/enumerable/tc_collect_with_index.rb +14 -14
  82. data/test/unit/extensions/enumerable/tc_detect_map.rb +20 -20
  83. data/test/unit/extensions/enumerable/tc_unique.rb +34 -34
  84. data/test/unit/extensions/hash/tc_deep_transform.rb +22 -22
  85. data/test/unit/extensions/hash/tc_except.rb +28 -28
  86. data/test/unit/extensions/hash/tc_slice.rb +13 -13
  87. data/test/unit/extensions/integer/tc_to_s_grp.rb +60 -0
  88. data/test/unit/extensions/integer/ts_all.rb +12 -0
  89. data/test/unit/extensions/io/tc_writelines.rb +149 -77
  90. data/test/unit/extensions/kernel/tc_integer.rb +75 -75
  91. data/test/unit/extensions/kernel/tc_raise_with_options.rb +155 -155
  92. data/test/unit/extensions/object/tc_inspect.rb +50 -50
  93. data/test/unit/extensions/string/tc_bool.tb +24 -24
  94. data/test/unit/extensions/string/tc_ends_with.rb +53 -53
  95. data/test/unit/extensions/string/tc_map_option_string.rb +15 -15
  96. data/test/unit/extensions/string/tc_nil_if_empty.rb +8 -8
  97. data/test/unit/extensions/string/tc_nil_if_whitespace.rb +8 -8
  98. data/test/unit/extensions/string/tc_quote_if.rb +18 -18
  99. data/test/unit/extensions/string/tc_starts_with.rb +53 -53
  100. data/test/unit/extensions/string/tc_to_symbol.rb +26 -26
  101. data/test/unit/extensions/string/tc_truncate.rb +18 -18
  102. data/test/unit/extensions/test/unit/tc_assert_raise_with_message.rb +16 -16
  103. data/test/unit/extensions/test/unit/tc_assert_subclass_of.rb +9 -9
  104. data/test/unit/extensions/test/unit/tc_assert_superclass_of.rb +9 -9
  105. data/test/unit/hash_utilities/tc_has_match.rb +70 -70
  106. data/test/unit/hash_utilities/tc_match.rb +83 -83
  107. data/test/unit/io/tc_writelines.rb +166 -106
  108. data/test/unit/quality/tc_parameter_checking.rb +389 -389
  109. data/test/unit/string_utilities/tc_truncate.rb +27 -27
  110. data/test/unit/tc_version.rb +15 -15
  111. metadata +6 -2
@@ -11,59 +11,59 @@ require 'stringio'
11
11
 
12
12
  class Test_String_ends_with < Test::Unit::TestCase
13
13
 
14
- def test_String_has_method
15
-
16
- assert ''.respond_to? :ends_with?
17
- end
18
-
19
- def test_with_nil
20
-
21
- assert ''.ends_with? nil
22
- end
23
-
24
- def test_with_single_strings
25
-
26
- assert ''.ends_with? ''
27
- assert 'a'.ends_with? ''
28
- assert 'a'.ends_with? 'a'
29
- assert_not 'b'.ends_with? 'a'
30
- assert_nil 'b'.ends_with? 'a'
31
- assert 'ab'.ends_with? 'b'
32
- assert 'abc'.ends_with? 'c'
33
- assert 'abc'.ends_with? 'bc'
34
- assert_not 'abc'.ends_with? 'ac'
35
- assert_nil 'abc'.ends_with? 'ac'
36
-
37
- assert 'abcdefghijklmnopqrstuvwxyz'.ends_with? ''
38
- assert 'abcdefghijklmnopqrstuvwxyz'.ends_with? 'z'
39
- assert 'abcdefghijklmnopqrstuvwxyz'.ends_with? 'yz'
40
- assert 'abcdefghijklmnopqrstuvwxyz'.ends_with? 'xyz'
41
- assert 'abcdefghijklmnopqrstuvwxyz'.ends_with? 'wxyz'
42
- assert 'abcdefghijklmnopqrstuvwxyz'.ends_with? 'vwxyz'
43
- end
44
-
45
- def test_multiple_strings
46
-
47
- assert ''.ends_with? '', 'd'
48
- assert_not ''.ends_with? 'c', 'd'
49
- assert_nil ''.ends_with? 'c', 'd'
50
- assert 'c'.ends_with? 'c', 'd'
51
- assert 'd'.ends_with? 'c', 'd'
52
-
53
- assert_equal 'd', 'abcd'.ends_with?('c', 'd')
54
- end
55
-
56
- def test_with_array
57
-
58
- prefixes = %w{ a c def }
59
-
60
- assert_not ''.ends_with?(*prefixes)
61
- assert_nil ''.ends_with?(*prefixes), 'empty string does not yield nil with given non-empty prefix(es)'
62
- assert 'abc'.ends_with?(*prefixes)
63
- assert_not 'd'.ends_with?(*prefixes)
64
- assert_nil 'd'.ends_with?(*prefixes)
65
- assert 'abcdef'.ends_with?(*prefixes)
66
- end
14
+ def test_String_has_method
15
+
16
+ assert ''.respond_to? :ends_with?
17
+ end
18
+
19
+ def test_with_nil
20
+
21
+ assert ''.ends_with? nil
22
+ end
23
+
24
+ def test_with_single_strings
25
+
26
+ assert ''.ends_with? ''
27
+ assert 'a'.ends_with? ''
28
+ assert 'a'.ends_with? 'a'
29
+ assert_not 'b'.ends_with? 'a'
30
+ assert_nil 'b'.ends_with? 'a'
31
+ assert 'ab'.ends_with? 'b'
32
+ assert 'abc'.ends_with? 'c'
33
+ assert 'abc'.ends_with? 'bc'
34
+ assert_not 'abc'.ends_with? 'ac'
35
+ assert_nil 'abc'.ends_with? 'ac'
36
+
37
+ assert 'abcdefghijklmnopqrstuvwxyz'.ends_with? ''
38
+ assert 'abcdefghijklmnopqrstuvwxyz'.ends_with? 'z'
39
+ assert 'abcdefghijklmnopqrstuvwxyz'.ends_with? 'yz'
40
+ assert 'abcdefghijklmnopqrstuvwxyz'.ends_with? 'xyz'
41
+ assert 'abcdefghijklmnopqrstuvwxyz'.ends_with? 'wxyz'
42
+ assert 'abcdefghijklmnopqrstuvwxyz'.ends_with? 'vwxyz'
43
+ end
44
+
45
+ def test_multiple_strings
46
+
47
+ assert ''.ends_with? '', 'd'
48
+ assert_not ''.ends_with? 'c', 'd'
49
+ assert_nil ''.ends_with? 'c', 'd'
50
+ assert 'c'.ends_with? 'c', 'd'
51
+ assert 'd'.ends_with? 'c', 'd'
52
+
53
+ assert_equal 'd', 'abcd'.ends_with?('c', 'd')
54
+ end
55
+
56
+ def test_with_array
57
+
58
+ prefixes = %w{ a c def }
59
+
60
+ assert_not ''.ends_with?(*prefixes)
61
+ assert_nil ''.ends_with?(*prefixes), 'empty string does not yield nil with given non-empty prefix(es)'
62
+ assert 'abc'.ends_with?(*prefixes)
63
+ assert_not 'd'.ends_with?(*prefixes)
64
+ assert_nil 'd'.ends_with?(*prefixes)
65
+ assert 'abcdef'.ends_with?(*prefixes)
66
+ end
67
67
  end
68
68
 
69
69
 
@@ -9,29 +9,29 @@ require 'test/unit'
9
9
 
10
10
  class Test_String_map_option_string < Test::Unit::TestCase
11
11
 
12
- def test_simple_uses
12
+ def test_simple_uses
13
13
 
14
- assert_nil 'abc'.map_option_string [ 'option-1', 'option-2' ]
14
+ assert_nil 'abc'.map_option_string [ 'option-1', 'option-2' ]
15
15
 
16
- assert_equal :abc, 'abc'.map_option_string([ 'abc' ])
16
+ assert_equal :abc, 'abc'.map_option_string([ 'abc' ])
17
17
 
18
- assert_equal :option_1, 'option-1'.map_option_string([ 'option-1', 'option-2' ])
19
- end
18
+ assert_equal :option_1, 'option-1'.map_option_string([ 'option-1', 'option-2' ])
19
+ end
20
20
 
21
- def test_shortcuts
21
+ def test_shortcuts
22
22
 
23
- option_strings = [ '[n]ame-only', '[f]ull-[p]ath' ]
23
+ option_strings = [ '[n]ame-only', '[f]ull-[p]ath' ]
24
24
 
25
- assert_equal :name_only, 'name-only'.map_option_string(option_strings)
26
- assert_equal :full_path, 'full-path'.map_option_string(option_strings)
25
+ assert_equal :name_only, 'name-only'.map_option_string(option_strings)
26
+ assert_equal :full_path, 'full-path'.map_option_string(option_strings)
27
27
 
28
- assert_equal :name_only, 'n'.map_option_string(option_strings)
29
- assert_equal :full_path, 'fp'.map_option_string(option_strings)
28
+ assert_equal :name_only, 'n'.map_option_string(option_strings)
29
+ assert_equal :full_path, 'fp'.map_option_string(option_strings)
30
30
 
31
- %w{ a m e - o l y u l p a t h }.each do |shortcut|
31
+ %w{ a m e - o l y u l p a t h }.each do |shortcut|
32
32
 
33
- assert_nil shortcut.map_option_string(option_strings)
34
- end
35
- end
33
+ assert_nil shortcut.map_option_string(option_strings)
34
+ end
35
+ end
36
36
  end
37
37
 
@@ -11,17 +11,17 @@ require 'stringio'
11
11
 
12
12
  class Test_String_nil_if_empty < Test::Unit::TestCase
13
13
 
14
- def test_String_has_method
14
+ def test_String_has_method
15
15
 
16
- assert ''.respond_to? :nil_if_empty
17
- end
16
+ assert ''.respond_to? :nil_if_empty
17
+ end
18
18
 
19
- def test_nil_if_empty
19
+ def test_nil_if_empty
20
20
 
21
- assert_nil ''.nil_if_empty
22
- assert_equal ' ', ' '.nil_if_empty
23
- assert_equal 'a', 'a'.nil_if_empty
24
- end
21
+ assert_nil ''.nil_if_empty
22
+ assert_equal ' ', ' '.nil_if_empty
23
+ assert_equal 'a', 'a'.nil_if_empty
24
+ end
25
25
  end
26
26
 
27
27
 
@@ -11,17 +11,17 @@ require 'stringio'
11
11
 
12
12
  class Test_String_nil_if_whitespace < Test::Unit::TestCase
13
13
 
14
- def test_String_has_method
14
+ def test_String_has_method
15
15
 
16
- assert ''.respond_to? :nil_if_whitespace
17
- end
16
+ assert ''.respond_to? :nil_if_whitespace
17
+ end
18
18
 
19
- def test_nil_if_whitespace
19
+ def test_nil_if_whitespace
20
20
 
21
- assert_nil ''.nil_if_whitespace
22
- assert_nil ' '.nil_if_whitespace
23
- assert_equal 'a', 'a'.nil_if_whitespace
24
- end
21
+ assert_nil ''.nil_if_whitespace
22
+ assert_nil ' '.nil_if_whitespace
23
+ assert_equal 'a', 'a'.nil_if_whitespace
24
+ end
25
25
  end
26
26
 
27
27
 
@@ -11,31 +11,31 @@ require 'stringio'
11
11
 
12
12
  class Test_String_quote_if < Test::Unit::TestCase
13
13
 
14
- def test_String_has_method
14
+ def test_String_has_method
15
15
 
16
- assert ''.respond_to? :quote_if
17
- end
16
+ assert ''.respond_to? :quote_if
17
+ end
18
18
 
19
- def test_with_no_options
19
+ def test_with_no_options
20
20
 
21
- assert_equal '', ''.quote_if
22
- assert_equal 'a', 'a'.quote_if
23
- assert_equal 'ab', 'ab'.quote_if
24
- assert_equal '"a b"', 'a b'.quote_if
25
- end
21
+ assert_equal '', ''.quote_if
22
+ assert_equal 'a', 'a'.quote_if
23
+ assert_equal 'ab', 'ab'.quote_if
24
+ assert_equal '"a b"', 'a b'.quote_if
25
+ end
26
26
 
27
- def test_with_quotables
27
+ def test_with_quotables
28
28
 
29
- assert_equal 'a b', 'a b'.quote_if(quotables: '-')
30
- assert_equal '"a-b"', 'a-b'.quote_if(quotables: '-')
31
- end
29
+ assert_equal 'a b', 'a b'.quote_if(quotables: '-')
30
+ assert_equal '"a-b"', 'a-b'.quote_if(quotables: '-')
31
+ end
32
32
 
33
- def test_with_quotes
33
+ def test_with_quotes
34
34
 
35
- assert_equal '"a b"', 'a b'.quote_if
36
- assert_equal '|a b|', 'a b'.quote_if(quotes: '|')
37
- assert_equal '[a b]', 'a b'.quote_if(quotes: [ '[', ']' ])
38
- end
35
+ assert_equal '"a b"', 'a b'.quote_if
36
+ assert_equal '|a b|', 'a b'.quote_if(quotes: '|')
37
+ assert_equal '[a b]', 'a b'.quote_if(quotes: [ '[', ']' ])
38
+ end
39
39
  end
40
40
 
41
41
 
@@ -11,59 +11,59 @@ require 'stringio'
11
11
 
12
12
  class Test_String_starts_with < Test::Unit::TestCase
13
13
 
14
- def test_String_has_method
15
-
16
- assert ''.respond_to? :starts_with?
17
- end
18
-
19
- def test_with_nil
20
-
21
- assert ''.starts_with? nil
22
- end
23
-
24
- def test_with_single_strings
25
-
26
- assert ''.starts_with? ''
27
- assert 'a'.starts_with? ''
28
- assert 'a'.starts_with? 'a'
29
- assert_not 'b'.starts_with? 'a'
30
- assert_nil 'b'.starts_with? 'a'
31
- assert 'ab'.starts_with? 'a'
32
- assert 'abc'.starts_with? 'a'
33
- assert 'abc'.starts_with? 'ab'
34
- assert_not 'abc'.starts_with? 'ac'
35
- assert_nil 'abc'.starts_with? 'ac'
36
-
37
- assert 'abcdefghijklmnopqrstuvwxz'.starts_with? ''
38
- assert 'abcdefghijklmnopqrstuvwxz'.starts_with? 'a'
39
- assert 'abcdefghijklmnopqrstuvwxz'.starts_with? 'ab'
40
- assert 'abcdefghijklmnopqrstuvwxz'.starts_with? 'abc'
41
- assert 'abcdefghijklmnopqrstuvwxz'.starts_with? 'abcd'
42
- assert 'abcdefghijklmnopqrstuvwxz'.starts_with? 'abcde'
43
- end
44
-
45
- def test_multiple_strings
46
-
47
- assert ''.starts_with? '', 'd'
48
- assert_not ''.starts_with? 'c', 'd'
49
- assert_nil ''.starts_with? 'c', 'd'
50
- assert 'c'.starts_with? 'c', 'd'
51
- assert 'd'.starts_with? 'c', 'd'
52
-
53
- assert_equal 'a', 'abcd'.starts_with?('a', 'b')
54
- end
55
-
56
- def test_with_array
57
-
58
- prefixes = %w{ a c def }
59
-
60
- assert_not ''.starts_with?(*prefixes)
61
- assert_nil ''.starts_with?(*prefixes)
62
- assert 'abc'.starts_with?(*prefixes)
63
- assert_not 'd'.starts_with?(*prefixes)
64
- assert_nil 'd'.starts_with?(*prefixes)
65
- assert 'defghi'.starts_with?(*prefixes)
66
- end
14
+ def test_String_has_method
15
+
16
+ assert ''.respond_to? :starts_with?
17
+ end
18
+
19
+ def test_with_nil
20
+
21
+ assert ''.starts_with? nil
22
+ end
23
+
24
+ def test_with_single_strings
25
+
26
+ assert ''.starts_with? ''
27
+ assert 'a'.starts_with? ''
28
+ assert 'a'.starts_with? 'a'
29
+ assert_not 'b'.starts_with? 'a'
30
+ assert_nil 'b'.starts_with? 'a'
31
+ assert 'ab'.starts_with? 'a'
32
+ assert 'abc'.starts_with? 'a'
33
+ assert 'abc'.starts_with? 'ab'
34
+ assert_not 'abc'.starts_with? 'ac'
35
+ assert_nil 'abc'.starts_with? 'ac'
36
+
37
+ assert 'abcdefghijklmnopqrstuvwxz'.starts_with? ''
38
+ assert 'abcdefghijklmnopqrstuvwxz'.starts_with? 'a'
39
+ assert 'abcdefghijklmnopqrstuvwxz'.starts_with? 'ab'
40
+ assert 'abcdefghijklmnopqrstuvwxz'.starts_with? 'abc'
41
+ assert 'abcdefghijklmnopqrstuvwxz'.starts_with? 'abcd'
42
+ assert 'abcdefghijklmnopqrstuvwxz'.starts_with? 'abcde'
43
+ end
44
+
45
+ def test_multiple_strings
46
+
47
+ assert ''.starts_with? '', 'd'
48
+ assert_not ''.starts_with? 'c', 'd'
49
+ assert_nil ''.starts_with? 'c', 'd'
50
+ assert 'c'.starts_with? 'c', 'd'
51
+ assert 'd'.starts_with? 'c', 'd'
52
+
53
+ assert_equal 'a', 'abcd'.starts_with?('a', 'b')
54
+ end
55
+
56
+ def test_with_array
57
+
58
+ prefixes = %w{ a c def }
59
+
60
+ assert_not ''.starts_with?(*prefixes)
61
+ assert_nil ''.starts_with?(*prefixes)
62
+ assert 'abc'.starts_with?(*prefixes)
63
+ assert_not 'd'.starts_with?(*prefixes)
64
+ assert_nil 'd'.starts_with?(*prefixes)
65
+ assert 'defghi'.starts_with?(*prefixes)
66
+ end
67
67
  end
68
68
 
69
69
 
@@ -9,43 +9,43 @@ require 'test/unit'
9
9
 
10
10
  class Test_String_to_symbol < Test::Unit::TestCase
11
11
 
12
- def test_empty_string
12
+ def test_empty_string
13
13
 
14
- assert_nil ''.to_symbol
15
- end
14
+ assert_nil ''.to_symbol
15
+ end
16
16
 
17
- def test_simple_string
17
+ def test_simple_string
18
18
 
19
- assert_equal :a, 'a'.to_symbol
20
- end
19
+ assert_equal :a, 'a'.to_symbol
20
+ end
21
21
 
22
- def test_string_with_spaces
22
+ def test_string_with_spaces
23
23
 
24
- assert_equal :some_symbol, 'some symbol'.to_symbol
25
- assert_nil 'some symbol'.to_symbol(reject_spaces: true)
26
- assert_nil 'some symbol'.to_symbol(reject_whitespace: true)
27
- end
24
+ assert_equal :some_symbol, 'some symbol'.to_symbol
25
+ assert_nil 'some symbol'.to_symbol(reject_spaces: true)
26
+ assert_nil 'some symbol'.to_symbol(reject_whitespace: true)
27
+ end
28
28
 
29
- def test_string_with_tabs
29
+ def test_string_with_tabs
30
30
 
31
- assert_equal :some_symbol, "some\tsymbol".to_symbol
32
- assert_nil "some\tsymbol".to_symbol(reject_tabs: true)
33
- assert_nil "some\tsymbol".to_symbol(reject_whitespace: true)
34
- end
31
+ assert_equal :some_symbol, "some\tsymbol".to_symbol
32
+ assert_nil "some\tsymbol".to_symbol(reject_tabs: true)
33
+ assert_nil "some\tsymbol".to_symbol(reject_whitespace: true)
34
+ end
35
35
 
36
- def test_string_with_hyphens
36
+ def test_string_with_hyphens
37
37
 
38
- assert_equal :some_symbol, 'some-symbol'.to_symbol
39
- assert_nil 'some-symbol'.to_symbol(reject_hyphens: true)
40
- end
38
+ assert_equal :some_symbol, 'some-symbol'.to_symbol
39
+ assert_nil 'some-symbol'.to_symbol(reject_hyphens: true)
40
+ end
41
41
 
42
- def test_string_with_transform_characters
42
+ def test_string_with_transform_characters
43
43
 
44
- assert_nil 'some#funky$symbol'.to_symbol
45
- assert_nil 'some#funky$symbol'.to_symbol transform_characters: [ ?', ?$ ]
46
- assert_nil 'some#funky$symbol'.to_symbol transform_characters: [ ?#, ?' ]
47
- assert_equal :some_funky_symbol, 'some#funky$symbol'.to_symbol(transform_characters: [ ?#, ?$ ])
48
- end
44
+ assert_nil 'some#funky$symbol'.to_symbol
45
+ assert_nil 'some#funky$symbol'.to_symbol transform_characters: [ ?', ?$ ]
46
+ assert_nil 'some#funky$symbol'.to_symbol transform_characters: [ ?#, ?' ]
47
+ assert_equal :some_funky_symbol, 'some#funky$symbol'.to_symbol(transform_characters: [ ?#, ?$ ])
48
+ end
49
49
  end
50
50
 
51
51
 
@@ -9,29 +9,29 @@ require 'test/unit'
9
9
 
10
10
  class Test_String_truncate < Test::Unit::TestCase
11
11
 
12
- def test_empty_string
12
+ def test_empty_string
13
13
 
14
- assert_equal '', ''.truncate(0)
15
- assert_equal '', ''.truncate(1)
16
- assert_equal '', ''.truncate(10)
17
- end
14
+ assert_equal '', ''.truncate(0)
15
+ assert_equal '', ''.truncate(1)
16
+ assert_equal '', ''.truncate(10)
17
+ end
18
18
 
19
- def test_short_string
19
+ def test_short_string
20
20
 
21
- assert_equal '.', 'ab'.truncate(1)
22
- assert_equal 'ab', 'ab'.truncate(2)
23
- assert_equal 'ab', 'ab'.truncate(10)
24
- end
21
+ assert_equal '.', 'ab'.truncate(1)
22
+ assert_equal 'ab', 'ab'.truncate(2)
23
+ assert_equal 'ab', 'ab'.truncate(10)
24
+ end
25
25
 
26
- def test_shortish_string
26
+ def test_shortish_string
27
27
 
28
- assert_equal '.', 'abcde'.truncate(1)
29
- assert_equal '..', 'abcde'.truncate(2)
30
- assert_equal '...', 'abcde'.truncate(3)
31
- assert_equal 'a...', 'abcde'.truncate(4)
32
- assert_equal 'abcde', 'abcde'.truncate(5)
33
- assert_equal 'abcde', 'abcde'.truncate(10)
34
- end
28
+ assert_equal '.', 'abcde'.truncate(1)
29
+ assert_equal '..', 'abcde'.truncate(2)
30
+ assert_equal '...', 'abcde'.truncate(3)
31
+ assert_equal 'a...', 'abcde'.truncate(4)
32
+ assert_equal 'abcde', 'abcde'.truncate(5)
33
+ assert_equal 'abcde', 'abcde'.truncate(10)
34
+ end
35
35
  end
36
36
 
37
37
 
@@ -8,31 +8,31 @@ require 'test/unit'
8
8
 
9
9
  class Test_assert_raise_with_message < Test::Unit::TestCase
10
10
 
11
- def test_no_class_and_specific_message
11
+ def test_no_class_and_specific_message
12
12
 
13
- assert_raise_with_message(nil, 'the-message') { raise ArgumentError, 'the-message' }
14
- end
13
+ assert_raise_with_message(nil, 'the-message') { raise ArgumentError, 'the-message' }
14
+ end
15
15
 
16
- def test_no_class_and_message_list
16
+ def test_no_class_and_message_list
17
17
 
18
- assert_raise_with_message(nil, [ 'first-message', 'a-message', 'the-message', 'last-message' ]) { raise ArgumentError, 'the-message' }
19
- end
18
+ assert_raise_with_message(nil, [ 'first-message', 'a-message', 'the-message', 'last-message' ]) { raise ArgumentError, 'the-message' }
19
+ end
20
20
 
21
- def test_specific_class_and_no_message
21
+ def test_specific_class_and_no_message
22
22
 
23
- assert_raise_with_message(::ArgumentError, nil) { raise ::ArgumentError, 'the-message' }
24
- end
23
+ assert_raise_with_message(::ArgumentError, nil) { raise ::ArgumentError, 'the-message' }
24
+ end
25
25
 
26
- def test_class_list_and_no_message
26
+ def test_class_list_and_no_message
27
27
 
28
- assert_raise_with_message([ ::ArgumentError, ::SystemExit ], nil) { raise ::ArgumentError, 'the-message' }
29
- assert_raise_with_message([ ::SystemExit, ::ArgumentError ], nil) { raise ::ArgumentError, 'the-message' }
30
- end
28
+ assert_raise_with_message([ ::ArgumentError, ::SystemExit ], nil) { raise ::ArgumentError, 'the-message' }
29
+ assert_raise_with_message([ ::SystemExit, ::ArgumentError ], nil) { raise ::ArgumentError, 'the-message' }
30
+ end
31
31
 
32
- def test_class_and_regex_message
32
+ def test_class_and_regex_message
33
33
 
34
- assert_raise_with_message(::RuntimeError, /the.*message/) { raise 'the-longer-message' }
35
- end
34
+ assert_raise_with_message(::RuntimeError, /the.*message/) { raise 'the-longer-message' }
35
+ end
36
36
  end
37
37
 
38
38
 
@@ -8,17 +8,17 @@ require 'test/unit'
8
8
 
9
9
  class Test_assert_subclass_of < Test::Unit::TestCase
10
10
 
11
- class Grandparent; end
12
- class Parent < Grandparent; end
13
- class Child < Parent; end
11
+ class Grandparent; end
12
+ class Parent < Grandparent; end
13
+ class Child < Parent; end
14
14
 
15
- def test_1
15
+ def test_1
16
16
 
17
- assert_subclass_of Object, Grandparent
18
- assert_subclass_of Grandparent, Parent
19
- assert_subclass_of Parent, Child
20
- assert_subclass_of Grandparent, Child
21
- end
17
+ assert_subclass_of Object, Grandparent
18
+ assert_subclass_of Grandparent, Parent
19
+ assert_subclass_of Parent, Child
20
+ assert_subclass_of Grandparent, Child
21
+ end
22
22
  end
23
23
 
24
24
 
@@ -8,17 +8,17 @@ require 'test/unit'
8
8
 
9
9
  class Test_assert_superclass_of < Test::Unit::TestCase
10
10
 
11
- class Grandparent; end
12
- class Parent < Grandparent; end
13
- class Child < Parent; end
11
+ class Grandparent; end
12
+ class Parent < Grandparent; end
13
+ class Child < Parent; end
14
14
 
15
- def test_1
15
+ def test_1
16
16
 
17
- assert_superclass_of Grandparent, Object
18
- assert_superclass_of Parent, Grandparent
19
- assert_superclass_of Child, Parent
20
- assert_superclass_of Child, Grandparent
21
- end
17
+ assert_superclass_of Grandparent, Object
18
+ assert_superclass_of Parent, Grandparent
19
+ assert_superclass_of Child, Parent
20
+ assert_superclass_of Child, Grandparent
21
+ end
22
22
  end
23
23
 
24
24