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
@@ -10,636 +10,636 @@ require 'test/unit'
10
10
 
11
11
  class Test_check_option_multiple_option_names < Test::Unit::TestCase
12
12
 
13
- include ::Xqsr3::Quality::ParameterChecking
13
+ include ::Xqsr3::Quality::ParameterChecking
14
14
 
15
- def check_method_stringise_stringize **options
15
+ def check_method_stringise_stringize **options
16
16
 
17
- check_option options, [ :stringise, :stringize ], nil: true
18
- end
17
+ check_option options, [ :stringise, :stringize ], nil: true
18
+ end
19
19
 
20
- def test_1
20
+ def test_1
21
21
 
22
- assert_nil check_method_stringise_stringize()
22
+ assert_nil check_method_stringise_stringize()
23
23
 
24
- assert_nil check_method_stringise_stringize(abc: :abc)
24
+ assert_nil check_method_stringise_stringize(abc: :abc)
25
25
 
26
- assert_equal :stringize, check_method_stringise_stringize(stringize: :stringize)
27
- assert_equal :stringise, check_method_stringise_stringize(stringise: :stringise)
28
- assert_equal :stringise, check_method_stringise_stringize(stringize: :stringize, stringise: :stringise)
29
- assert_equal :stringise, check_method_stringise_stringize(stringise: :stringise, stringize: :stringize)
30
- end
26
+ assert_equal :stringize, check_method_stringise_stringize(stringize: :stringize)
27
+ assert_equal :stringise, check_method_stringise_stringize(stringise: :stringise)
28
+ assert_equal :stringise, check_method_stringise_stringize(stringize: :stringize, stringise: :stringise)
29
+ assert_equal :stringise, check_method_stringise_stringize(stringise: :stringise, stringize: :stringize)
30
+ end
31
31
  end
32
32
 
33
33
  class Test_parameter_checks_as_separate_module < Test::Unit::TestCase
34
34
 
35
- PC = ::Xqsr3::Quality::ParameterChecking
35
+ PC = ::Xqsr3::Quality::ParameterChecking
36
36
 
37
- # test 1
37
+ # test 1
38
38
 
39
- def check_method_1 a, **options
39
+ def check_method_1 a, **options
40
40
 
41
- PC.check_option options, :o1, nil: true
42
- PC.check_option options, :o2, nil: false
41
+ PC.check_option options, :o1, nil: true
42
+ PC.check_option options, :o2, nil: false
43
43
 
44
- PC.check_param a, 'a'
45
- end
44
+ PC.check_param a, 'a'
45
+ end
46
46
 
47
- def test_1
47
+ def test_1
48
48
 
49
- assert_raise ArgumentError do
49
+ assert_raise ArgumentError do
50
50
 
51
- check_method_1(nil)
52
- end
51
+ check_method_1(nil)
52
+ end
53
53
 
54
- assert_equal true, check_method_1(true, o1: true, o2: false)
55
- assert_equal '', check_method_1('', o1: true, o2: false)
56
- assert_equal [], check_method_1([], o1: true, o2: false)
57
- assert_equal Hash.new, check_method_1(Hash.new, o1: true, o2: false)
58
- end
54
+ assert_equal true, check_method_1(true, o1: true, o2: false)
55
+ assert_equal '', check_method_1('', o1: true, o2: false)
56
+ assert_equal [], check_method_1([], o1: true, o2: false)
57
+ assert_equal Hash.new, check_method_1(Hash.new, o1: true, o2: false)
58
+ end
59
59
 
60
60
 
61
- # test 2
61
+ # test 2
62
62
  end
63
63
 
64
64
  class Test_parameter_checks_as_included_module < Test::Unit::TestCase
65
65
 
66
- include ::Xqsr3::Quality::ParameterChecking
66
+ include ::Xqsr3::Quality::ParameterChecking
67
67
 
68
- # test 0
68
+ # test 0
69
69
 
70
- def test_access_control_instance
70
+ def test_access_control_instance
71
71
 
72
- assert private_methods.include?(:check_param), "check_param() must be a private method of the instance"
73
- assert private_methods.include?(:check_parameter), "check_param() must be a private method of the instance"
72
+ assert private_methods.include?(:check_param), "check_param() must be a private method of the instance"
73
+ assert private_methods.include?(:check_parameter), "check_param() must be a private method of the instance"
74
74
 
75
- assert self.class.private_instance_methods.include?(:check_param), "check_param() must be a private method of the instance"
76
- assert self.class.private_instance_methods.include?(:check_parameter), "check_param() must be a private method of the instance"
77
- end
75
+ assert self.class.private_instance_methods.include?(:check_param), "check_param() must be a private method of the instance"
76
+ assert self.class.private_instance_methods.include?(:check_parameter), "check_param() must be a private method of the instance"
77
+ end
78
78
 
79
- def test_access_control_private
79
+ def test_access_control_private
80
80
 
81
- assert self.class.private_methods.include?(:check_param), "check_param() must be a private method of the class"
82
- assert self.class.private_methods.include?(:check_parameter), "check_param() must be a private method of the class"
83
- end
81
+ assert self.class.private_methods.include?(:check_param), "check_param() must be a private method of the class"
82
+ assert self.class.private_methods.include?(:check_parameter), "check_param() must be a private method of the class"
83
+ end
84
84
 
85
85
 
86
- # test 1
86
+ # test 1
87
87
 
88
- def check_method_1 a
88
+ def check_method_1 a
89
89
 
90
- check_param a, 'a'
91
- end
90
+ check_param a, 'a'
91
+ end
92
92
 
93
- def self.check_method_1_class a
93
+ def self.check_method_1_class a
94
94
 
95
- check_param a, 'a'
96
- end
95
+ check_param a, 'a'
96
+ end
97
97
 
98
- def test_1
98
+ def test_1
99
99
 
100
- assert_raise ArgumentError do
100
+ assert_raise ArgumentError do
101
101
 
102
- check_method_1(nil)
103
- end
102
+ check_method_1(nil)
103
+ end
104
104
 
105
- assert_raise ArgumentError do
105
+ assert_raise ArgumentError do
106
106
 
107
- self.class.check_method_1_class(nil)
108
- end
107
+ self.class.check_method_1_class(nil)
108
+ end
109
109
 
110
- assert_equal true, check_method_1(true)
111
- assert_equal '', check_method_1('')
112
- assert_equal [], check_method_1([])
113
- assert_equal Hash.new, check_method_1(Hash.new)
110
+ assert_equal true, check_method_1(true)
111
+ assert_equal '', check_method_1('')
112
+ assert_equal [], check_method_1([])
113
+ assert_equal Hash.new, check_method_1(Hash.new)
114
114
 
115
- assert_equal true, self.class.check_method_1_class(true)
116
- assert_equal '', self.class.check_method_1_class('')
117
- assert_equal [], self.class.check_method_1_class([])
118
- assert_equal Hash.new, self.class.check_method_1_class(Hash.new)
119
- end
115
+ assert_equal true, self.class.check_method_1_class(true)
116
+ assert_equal '', self.class.check_method_1_class('')
117
+ assert_equal [], self.class.check_method_1_class([])
118
+ assert_equal Hash.new, self.class.check_method_1_class(Hash.new)
119
+ end
120
120
 
121
121
 
122
- # test 2
122
+ # test 2
123
123
 
124
- def check_method_2 a, types, options = {}
124
+ def check_method_2 a, types, options = {}
125
125
 
126
- check_param a, 'a', options.merge({ types: types })
127
- end
126
+ check_param a, 'a', options.merge({ types: types })
127
+ end
128
128
 
129
- def test_2
129
+ def test_2
130
130
 
131
- assert_equal true, check_method_2(true, [ ::TrueClass ])
132
- assert_equal true, check_method_2(true, [ :boolean ])
133
- assert_equal true, check_method_2(true, [ ::TrueClass, ::String, ::Symbol ])
134
- assert_raise TypeError do
135
- check_method_2(true, [ ::String, ::Symbol, ::FalseClass ])
136
- end
137
- assert_equal true, check_method_2(true, [ ::TrueClass ], nothrow: true)
138
- assert_nil check_method_2(true, [ ::FalseClass ], nothrow: true)
139
- assert_nil check_method_2('abc', [ ::Symbol, ::Regexp ], nothrow: true)
140
- assert_nil check_method_2([ 'abc' ], [ [ ::Symbol ], ::Regexp ], nothrow: true)
141
- assert_not_nil check_method_2([ 'abc' ], [ [ ::String ], ::Regexp ], nothrow: true)
142
- assert_not_nil check_method_2(//, [ [ ::String ], ::Regexp ], nothrow: true)
143
- assert_not_nil check_method_2([ [ 'abc', 'def' ], [ 'ghi', 'jkl' ] ], [ [ ::String ], ::Regexp, [ ::Array ] ], nothrow: true)
131
+ assert_equal true, check_method_2(true, [ ::TrueClass ])
132
+ assert_equal true, check_method_2(true, [ :boolean ])
133
+ assert_equal true, check_method_2(true, [ ::TrueClass, ::String, ::Symbol ])
134
+ assert_raise TypeError do
135
+ check_method_2(true, [ ::String, ::Symbol, ::FalseClass ])
136
+ end
137
+ assert_equal true, check_method_2(true, [ ::TrueClass ], nothrow: true)
138
+ assert_nil check_method_2(true, [ ::FalseClass ], nothrow: true)
139
+ assert_nil check_method_2('abc', [ ::Symbol, ::Regexp ], nothrow: true)
140
+ assert_nil check_method_2([ 'abc' ], [ [ ::Symbol ], ::Regexp ], nothrow: true)
141
+ assert_not_nil check_method_2([ 'abc' ], [ [ ::String ], ::Regexp ], nothrow: true)
142
+ assert_not_nil check_method_2(//, [ [ ::String ], ::Regexp ], nothrow: true)
143
+ assert_not_nil check_method_2([ [ 'abc', 'def' ], [ 'ghi', 'jkl' ] ], [ [ ::String ], ::Regexp, [ ::Array ] ], nothrow: true)
144
144
 
145
- assert_not_nil check_method_2([ [ 'abc', 'def' ], [ 'ghi', 'jkl' ] ], [ [ ::String ], ::Regexp, [ ::Array ] ], nothrow: true) do |v|
145
+ assert_not_nil check_method_2([ [ 'abc', 'def' ], [ 'ghi', 'jkl' ] ], [ [ ::String ], ::Regexp, [ ::Array ] ], nothrow: true) do |v|
146
146
 
147
- if ::Array === v
147
+ if ::Array === v
148
148
 
149
- na = v.count { |v2| ::Array === v2 }
149
+ na = v.count { |v2| ::Array === v2 }
150
150
 
151
- 0 == na || v.size == na
152
- else
151
+ 0 == na || v.size == na
152
+ else
153
153
 
154
- true
155
- end
156
- end
154
+ true
155
+ end
156
+ end
157
157
 
158
- assert_nil check_method_2([ [ 'abc', 'def' ], nil, [ 'ghi', 'jkl' ] ], [ [ ::String ], ::Regexp, [ ::Array ] ], nothrow: true) do |v|
158
+ assert_nil check_method_2([ [ 'abc', 'def' ], nil, [ 'ghi', 'jkl' ] ], [ [ ::String ], ::Regexp, [ ::Array ] ], nothrow: true) do |v|
159
159
 
160
- if ::Array === v
160
+ if ::Array === v
161
161
 
162
- na = v.count { |v2| ::Array === v2 }
162
+ na = v.count { |v2| ::Array === v2 }
163
163
 
164
- 0 == na || v.size == na
165
- else
164
+ 0 == na || v.size == na
165
+ else
166
166
 
167
- true
168
- end
169
- end
170
- end
167
+ true
168
+ end
169
+ end
170
+ end
171
171
 
172
172
 
173
- # test 3
173
+ # test 3
174
174
 
175
- def check_method_3 a, types, values, options = {}
175
+ def check_method_3 a, types, values, options = {}
176
176
 
177
- check_param a, 'a', options.merge({ types: types, values: values })
178
- end
177
+ check_param a, 'a', options.merge({ types: types, values: values })
178
+ end
179
179
 
180
- def test_3
180
+ def test_3
181
181
 
182
- assert_raise RangeError do
183
- check_method_3(-1, nil, [ 0..2 ])
184
- end
185
- assert_equal 0, check_method_3(0, nil, [ 0..2 ])
186
- assert_equal 1, check_method_3(1, nil, [ 0..2 ])
187
- assert_equal 2, check_method_3(2, nil, [ 0..2 ])
188
- assert_raise RangeError do
189
- check_method_3(3, nil, [ 0..2 ])
190
- end
191
- end
182
+ assert_raise RangeError do
183
+ check_method_3(-1, nil, [ 0..2 ])
184
+ end
185
+ assert_equal 0, check_method_3(0, nil, [ 0..2 ])
186
+ assert_equal 1, check_method_3(1, nil, [ 0..2 ])
187
+ assert_equal 2, check_method_3(2, nil, [ 0..2 ])
188
+ assert_raise RangeError do
189
+ check_method_3(3, nil, [ 0..2 ])
190
+ end
191
+ end
192
192
 
193
193
 
194
- # test 4
194
+ # test 4
195
195
 
196
- def check_method_4 a, types, values, options = {}, &block
196
+ def check_method_4 a, types, values, options = {}, &block
197
197
 
198
- check_param a, 'a', options.merge({ types: types, values: values }), &block
199
- end
198
+ check_param a, 'a', options.merge({ types: types, values: values }), &block
199
+ end
200
200
 
201
- def test_4
201
+ def test_4
202
202
 
203
- assert_equal 0, check_method_4(0, nil, nil)
204
- assert_equal 0, check_method_4(0, nil, nil) { |n| 0 == n }
203
+ assert_equal 0, check_method_4(0, nil, nil)
204
+ assert_equal 0, check_method_4(0, nil, nil) { |n| 0 == n }
205
205
 
206
- assert_raise RangeError do
207
- check_method_4(-1, nil, nil) { |n| 0 == n }
208
- end
206
+ assert_raise RangeError do
207
+ check_method_4(-1, nil, nil) { |n| 0 == n }
208
+ end
209
209
 
210
- assert_raise ArgumentError do
211
- check_method_4('-1', nil, nil) { |n| 0 == n }
212
- end
210
+ assert_raise ArgumentError do
211
+ check_method_4('-1', nil, nil) { |n| 0 == n }
212
+ end
213
213
 
214
- assert_raise TypeError do
215
- check_method_4('-1', [ ::Numeric ], nil)
216
- end
217
- assert_raise ArgumentError do
218
- check_method_4('-1', [ ::String ], [ '-2', '0', '+1', '+2' ])
219
- end
220
- assert_equal '-1', check_method_4('-1', [ ::String ], [ '-2', '-1', '0', '+1', '+2' ])
221
- # assert_raise RangeError do
222
- # check_method_4('-1', [ ::String ], [ '-2', '0', '+1', '+2' ]) {
223
- # end
214
+ assert_raise TypeError do
215
+ check_method_4('-1', [ ::Numeric ], nil)
216
+ end
217
+ assert_raise ArgumentError do
218
+ check_method_4('-1', [ ::String ], [ '-2', '0', '+1', '+2' ])
219
+ end
220
+ assert_equal '-1', check_method_4('-1', [ ::String ], [ '-2', '-1', '0', '+1', '+2' ])
221
+ # assert_raise RangeError do
222
+ # check_method_4('-1', [ ::String ], [ '-2', '0', '+1', '+2' ]) {
223
+ # end
224
224
 
225
- # check_param(id, 'id', types: ::Integer) { |v| raise ArgumentError, "'id' must be a positive integer" unless v > 0 }
225
+ # check_param(id, 'id', types: ::Integer) { |v| raise ArgumentError, "'id' must be a positive integer" unless v > 0 }
226
226
 
227
- end
227
+ end
228
228
 
229
229
 
230
230
 
231
- # test 5
231
+ # test 5
232
232
 
233
- def check_method_5 a, options = {}
233
+ def check_method_5 a, options = {}
234
234
 
235
- check_param a, 'a', options
236
- end
235
+ check_param a, 'a', options
236
+ end
237
237
 
238
- def test_5
238
+ def test_5
239
239
 
240
- assert_equal "", check_method_5("", require_empty: true)
241
- assert_equal "a", check_method_5("a", reject_empty: true)
240
+ assert_equal "", check_method_5("", require_empty: true)
241
+ assert_equal "a", check_method_5("a", reject_empty: true)
242
242
 
243
- assert_raise ArgumentError do
244
- check_method_5("", reject_empty: true)
245
- end
243
+ assert_raise ArgumentError do
244
+ check_method_5("", reject_empty: true)
245
+ end
246
246
 
247
247
  if false
248
- assert_raise ArgumentError do
249
- check_method_5(nil)
250
- end
251
-
252
- assert_equal true, check_method_5(true)
253
- assert_equal '', check_method_5('')
254
- assert_equal [], check_method_5([])
255
- assert_equal Hash.new, check_method_5(Hash.new)
248
+ assert_raise ArgumentError do
249
+ check_method_5(nil)
250
+ end
251
+
252
+ assert_equal true, check_method_5(true)
253
+ assert_equal '', check_method_5('')
254
+ assert_equal [], check_method_5([])
255
+ assert_equal Hash.new, check_method_5(Hash.new)
256
256
  end
257
- end
257
+ end
258
258
 
259
259
 
260
- # test 6
260
+ # test 6
261
261
 
262
- def check_method_6 a, types, values, options = {}, &block
262
+ def check_method_6 a, types, values, options = {}, &block
263
263
 
264
- check_param a, 'a', options.merge({ types: types, values: values }), &block
265
- end
264
+ check_param a, 'a', options.merge({ types: types, values: values }), &block
265
+ end
266
266
 
267
- def test_6
267
+ def test_6
268
268
 
269
- begin
270
- check_method_6 '', [ ::Hash ], []
269
+ begin
270
+ check_method_6 '', [ ::Hash ], []
271
271
 
272
- assert(false, 'should not get here')
273
- rescue TypeError => ax
272
+ assert(false, 'should not get here')
273
+ rescue TypeError => ax
274
274
 
275
- assert_match(/^parameter 'a' \(String\) must be an instance of Hash$/, ax.message)
276
- rescue => x
275
+ assert_match(/^parameter 'a' \(String\) must be an instance of Hash$/, ax.message)
276
+ rescue => x
277
277
 
278
- assert(false, "wrong exception type #{x.class} (with message '#{x.message}')")
279
- end
278
+ assert(false, "wrong exception type #{x.class} (with message '#{x.message}')")
279
+ end
280
280
 
281
281
 
282
- begin
283
- check_method_6 '', [ ::String ], [ 'b', 'c', 'd' ]
282
+ begin
283
+ check_method_6 '', [ ::String ], [ 'b', 'c', 'd' ]
284
284
 
285
- assert(false, 'should not get here')
286
- rescue ArgumentError => ax
285
+ assert(false, 'should not get here')
286
+ rescue ArgumentError => ax
287
287
 
288
- assert_match(/^parameter 'a' value '' not found equal\/within any of required values or ranges$/, ax.message)
289
- rescue => x
288
+ assert_match(/^parameter 'a' value '' not found equal\/within any of required values or ranges$/, ax.message)
289
+ rescue => x
290
290
 
291
- assert(false, "wrong exception type #{x.class} (with message '#{x.message}')")
292
- end
293
- end
291
+ assert(false, "wrong exception type #{x.class} (with message '#{x.message}')")
292
+ end
293
+ end
294
294
 
295
295
 
296
- # test 7 - verify that can include an array of types in the array of types
296
+ # test 7 - verify that can include an array of types in the array of types
297
297
 
298
- def check_method_7 a, types, values, options = {}, &block
298
+ def check_method_7 a, types, values, options = {}, &block
299
299
 
300
- check_param a, 'a', options.merge({ types: types, values: values }), &block
301
- end
300
+ check_param a, 'a', options.merge({ types: types, values: values }), &block
301
+ end
302
302
 
303
- def test_7
303
+ def test_7
304
304
 
305
- assert_equal [], check_method_7([], [ ::Array ], nil)
305
+ assert_equal [], check_method_7([], [ ::Array ], nil)
306
306
 
307
- assert_equal [ 'abc' ], check_method_7([ 'abc' ], [ ::Array ], nil)
307
+ assert_equal [ 'abc' ], check_method_7([ 'abc' ], [ ::Array ], nil)
308
308
 
309
- assert_equal [ 'abc' ], check_method_7([ 'abc' ], [ [ ::String ] ], nil)
309
+ assert_equal [ 'abc' ], check_method_7([ 'abc' ], [ [ ::String ] ], nil)
310
310
 
311
- assert_equal [ 'abc' ], check_method_7([ 'abc' ], [ [ ::Regexp, ::String ] ], nil)
311
+ assert_equal [ 'abc' ], check_method_7([ 'abc' ], [ [ ::Regexp, ::String ] ], nil)
312
312
 
313
- assert_equal [ :'abc' ], check_method_7([ :'abc' ], [ [ ::Regexp, ::Symbol ] ], nil)
313
+ assert_equal [ :'abc' ], check_method_7([ :'abc' ], [ [ ::Regexp, ::Symbol ] ], nil)
314
314
 
315
315
 
316
- begin
317
- check_method_7 [ 'abc' ], [ ::Symbol, [ ::Regexp, ::Symbol ], ::Hash ], nil
316
+ begin
317
+ check_method_7 [ 'abc' ], [ ::Symbol, [ ::Regexp, ::Symbol ], ::Hash ], nil
318
318
 
319
- assert(false, 'should not get here')
320
- rescue TypeError => ax
319
+ assert(false, 'should not get here')
320
+ rescue TypeError => ax
321
321
 
322
- assert_match(/^parameter 'a' \(Array\) must be an instance of Symbol or Hash, or an array containing instance\(s\) of Regexp or Symbol$/, ax.message)
323
- rescue => x
322
+ assert_match(/^parameter 'a' \(Array\) must be an instance of Symbol or Hash, or an array containing instance\(s\) of Regexp or Symbol$/, ax.message)
323
+ rescue => x
324
324
 
325
- assert(false, "wrong exception type #{x.class}) (with message '#{x.message}'")
326
- end
325
+ assert(false, "wrong exception type #{x.class}) (with message '#{x.message}'")
326
+ end
327
327
 
328
328
 
329
- begin
330
- check_method_7 [ 'abc' ], [ [ ::Regexp, ::Symbol ] ], nil
329
+ begin
330
+ check_method_7 [ 'abc' ], [ [ ::Regexp, ::Symbol ] ], nil
331
331
 
332
- assert(false, 'should not get here')
333
- rescue TypeError => ax
332
+ assert(false, 'should not get here')
333
+ rescue TypeError => ax
334
334
 
335
- assert_match(/^parameter 'a' \(Array\) must be an array containing instance\(s\) of Regexp or Symbol$/, ax.message)
336
- rescue => x
335
+ assert_match(/^parameter 'a' \(Array\) must be an array containing instance\(s\) of Regexp or Symbol$/, ax.message)
336
+ rescue => x
337
337
 
338
- assert(false, "wrong exception type #{x.class}) (with message '#{x.message}'")
339
- end
340
- end
338
+ assert(false, "wrong exception type #{x.class}) (with message '#{x.message}'")
339
+ end
340
+ end
341
341
 
342
342
 
343
- # responds_to
343
+ # responds_to
344
344
 
345
- def check_responds_to a, messages, options = {}, &block
345
+ def check_responds_to a, messages, options = {}, &block
346
346
 
347
- check_param a, 'a', options.merge({ responds_to: messages }), &block
348
- end
347
+ check_param a, 'a', options.merge({ responds_to: messages }), &block
348
+ end
349
349
 
350
- def test_responds_to
350
+ def test_responds_to
351
351
 
352
- assert check_responds_to Hash.new, [ :[], :map, :to_s ]
353
- assert_raise ::TypeError do
352
+ assert check_responds_to Hash.new, [ :[], :map, :to_s ]
353
+ assert_raise ::TypeError do
354
354
 
355
- check_responds_to Hash.new, [ :this_is_not_a_Hash_method ]
356
- end
355
+ check_responds_to Hash.new, [ :this_is_not_a_Hash_method ]
356
+ end
357
357
 
358
- # check can pass single types
359
- assert check_responds_to Hash.new, :[]
360
- assert check_responds_to Hash.new, :map
361
- assert check_responds_to Hash.new, :to_s
362
- end
358
+ # check can pass single types
359
+ assert check_responds_to Hash.new, :[]
360
+ assert check_responds_to Hash.new, :map
361
+ assert check_responds_to Hash.new, :to_s
362
+ end
363
363
 
364
364
 
365
365
 
366
- # test type:
366
+ # test type:
367
367
 
368
- def check_method_type a, type
368
+ def check_method_type a, type
369
369
 
370
- check_parameter a, 'a', type: type
371
- end
370
+ check_parameter a, 'a', type: type
371
+ end
372
372
 
373
- def self.check_method_type_class a, type
373
+ def self.check_method_type_class a, type
374
374
 
375
- check_parameter a, 'a', type: type
376
- end
375
+ check_parameter a, 'a', type: type
376
+ end
377
377
 
378
- def test_type
378
+ def test_type
379
379
 
380
- assert_kind_of ::String, check_method_type('', ::String)
380
+ assert_kind_of ::String, check_method_type('', ::String)
381
381
 
382
- assert_raise TypeError do
382
+ assert_raise TypeError do
383
383
 
384
- check_method_type :sym, ::String
385
- end
384
+ check_method_type :sym, ::String
385
+ end
386
386
 
387
- assert_kind_of ::String, self.class.check_method_type_class('', ::String)
387
+ assert_kind_of ::String, self.class.check_method_type_class('', ::String)
388
388
 
389
- assert_raise TypeError do
389
+ assert_raise TypeError do
390
390
 
391
- self.class.check_method_type_class :sym, ::String
392
- end
391
+ self.class.check_method_type_class :sym, ::String
392
+ end
393
393
 
394
394
 
395
- # arrays of strings
395
+ # arrays of strings
396
396
 
397
- assert_kind_of ::Array, check_method_type([ 'abc' ], [ ::String ])
398
- end
397
+ assert_kind_of ::Array, check_method_type([ 'abc' ], [ ::String ])
398
+ end
399
399
 
400
400
 
401
- # test treat_as_option
401
+ # test treat_as_option
402
402
 
403
- def check_method_tao_1 h, o, options = {}, &block
403
+ def check_method_tao_1 h, o, options = {}, &block
404
404
 
405
- check_parameter h[o], o, options.merge({ treat_as_option: true }), &block
406
- end
405
+ check_parameter h[o], o, options.merge({ treat_as_option: true }), &block
406
+ end
407
407
 
408
- def test_tao_1
408
+ def test_tao_1
409
409
 
410
- assert_true check_method_tao_1({ thing: true }, :thing)
411
- assert_false check_method_tao_1({ thing: false }, :thing)
412
- assert_equal [], check_method_tao_1({ thing: [] }, :thing)
410
+ assert_true check_method_tao_1({ thing: true }, :thing)
411
+ assert_false check_method_tao_1({ thing: false }, :thing)
412
+ assert_equal [], check_method_tao_1({ thing: [] }, :thing)
413
413
 
414
- begin
415
- check_method_tao_1({ thing: true }, :thingy)
414
+ begin
415
+ check_method_tao_1({ thing: true }, :thingy)
416
416
 
417
- assert(false, 'should not get here')
418
- rescue ArgumentError => ax
417
+ assert(false, 'should not get here')
418
+ rescue ArgumentError => ax
419
419
 
420
- assert_equal "option ':thingy' may not be nil", ax.message
421
- rescue => x
420
+ assert_equal "option ':thingy' may not be nil", ax.message
421
+ rescue => x
422
422
 
423
- assert(false, "wrong exception type #{x.class}) (with message '#{x.message}'")
424
- end
423
+ assert(false, "wrong exception type #{x.class}) (with message '#{x.message}'")
424
+ end
425
425
 
426
- begin
427
- check_method_tao_1({ thing: true }, 'thingy')
426
+ begin
427
+ check_method_tao_1({ thing: true }, 'thingy')
428
428
 
429
- assert(false, 'should not get here')
430
- rescue ArgumentError => ax
429
+ assert(false, 'should not get here')
430
+ rescue ArgumentError => ax
431
431
 
432
- assert_equal "option 'thingy' may not be nil", ax.message
433
- rescue => x
432
+ assert_equal "option 'thingy' may not be nil", ax.message
433
+ rescue => x
434
434
 
435
- assert(false, "wrong exception type #{x.class}) (with message '#{x.message}'")
436
- end
435
+ assert(false, "wrong exception type #{x.class}) (with message '#{x.message}'")
436
+ end
437
437
 
438
- begin
439
- check_method_tao_1({ thing: true }, ':thingy')
438
+ begin
439
+ check_method_tao_1({ thing: true }, ':thingy')
440
440
 
441
- assert(false, 'should not get here')
442
- rescue ArgumentError => ax
441
+ assert(false, 'should not get here')
442
+ rescue ArgumentError => ax
443
443
 
444
- assert_equal "option ':thingy' may not be nil", ax.message
445
- rescue => x
444
+ assert_equal "option ':thingy' may not be nil", ax.message
445
+ rescue => x
446
446
 
447
- assert(false, "wrong exception type #{x.class}) (with message '#{x.message}'")
448
- end
449
- end
447
+ assert(false, "wrong exception type #{x.class}) (with message '#{x.message}'")
448
+ end
449
+ end
450
450
 
451
451
 
452
- # test treat_as_option
452
+ # test treat_as_option
453
453
 
454
- def check_method_tao_2 h, o, options = {}, &block
454
+ def check_method_tao_2 h, o, options = {}, &block
455
455
 
456
- check_option h, o, options.merge({ }), &block
457
- end
456
+ check_option h, o, options.merge({ }), &block
457
+ end
458
458
 
459
- def check_method_tao_class_2 h, o, options = {}, &block
459
+ def check_method_tao_class_2 h, o, options = {}, &block
460
460
 
461
- check_option h, o, options.merge({ }), &block
462
- end
461
+ check_option h, o, options.merge({ }), &block
462
+ end
463
463
 
464
- def test_tao_2
464
+ def test_tao_2
465
465
 
466
- assert_true check_method_tao_2({ thing: true }, :thing)
467
- assert_false check_method_tao_2({ thing: false }, :thing)
468
- assert_equal [], check_method_tao_2({ thing: [] }, :thing)
466
+ assert_true check_method_tao_2({ thing: true }, :thing)
467
+ assert_false check_method_tao_2({ thing: false }, :thing)
468
+ assert_equal [], check_method_tao_2({ thing: [] }, :thing)
469
469
 
470
- assert_true check_method_tao_class_2({ thing: true }, :thing)
471
- assert_false check_method_tao_class_2({ thing: false }, :thing)
472
- assert_equal [], check_method_tao_class_2({ thing: [] }, :thing)
470
+ assert_true check_method_tao_class_2({ thing: true }, :thing)
471
+ assert_false check_method_tao_class_2({ thing: false }, :thing)
472
+ assert_equal [], check_method_tao_class_2({ thing: [] }, :thing)
473
473
 
474
- begin
475
- check_method_tao_2({ thing: true }, :thingy)
474
+ begin
475
+ check_method_tao_2({ thing: true }, :thingy)
476
476
 
477
- assert(false, 'should not get here')
478
- rescue ArgumentError => ax
477
+ assert(false, 'should not get here')
478
+ rescue ArgumentError => ax
479
479
 
480
- assert_equal "option ':thingy' may not be nil", ax.message
481
- rescue => x
480
+ assert_equal "option ':thingy' may not be nil", ax.message
481
+ rescue => x
482
482
 
483
- assert(false, "wrong exception type #{x.class}) (with message '#{x.message}'")
484
- end
483
+ assert(false, "wrong exception type #{x.class}) (with message '#{x.message}'")
484
+ end
485
485
 
486
- begin
487
- check_method_tao_2({ thing: true }, 'thingy')
486
+ begin
487
+ check_method_tao_2({ thing: true }, 'thingy')
488
488
 
489
- assert(false, 'should not get here')
490
- rescue ArgumentError => ax
489
+ assert(false, 'should not get here')
490
+ rescue ArgumentError => ax
491
491
 
492
- assert_equal "option 'thingy' may not be nil", ax.message
493
- rescue => x
492
+ assert_equal "option 'thingy' may not be nil", ax.message
493
+ rescue => x
494
494
 
495
- assert(false, "wrong exception type #{x.class}) (with message '#{x.message}'")
496
- end
495
+ assert(false, "wrong exception type #{x.class}) (with message '#{x.message}'")
496
+ end
497
497
 
498
- begin
499
- check_method_tao_2({ thing: true }, ':thingy')
498
+ begin
499
+ check_method_tao_2({ thing: true }, ':thingy')
500
500
 
501
- assert(false, 'should not get here')
502
- rescue ArgumentError => ax
501
+ assert(false, 'should not get here')
502
+ rescue ArgumentError => ax
503
503
 
504
- assert_equal "option ':thingy' may not be nil", ax.message
505
- rescue => x
504
+ assert_equal "option ':thingy' may not be nil", ax.message
505
+ rescue => x
506
506
 
507
- assert(false, "wrong exception type #{x.class}) (with message '#{x.message}'")
508
- end
509
- end
507
+ assert(false, "wrong exception type #{x.class}) (with message '#{x.message}'")
508
+ end
509
+ end
510
510
 
511
- # test multiple option names
511
+ # test multiple option names
512
512
 
513
- def check_method_multiple_option_names h, o, options = {}, &block
513
+ def check_method_multiple_option_names h, o, options = {}, &block
514
514
 
515
- check_option h, o, options.merge({ }), &block
516
- end
515
+ check_option h, o, options.merge({ }), &block
516
+ end
517
517
 
518
- def test_multiple_option_names
518
+ def test_multiple_option_names
519
519
 
520
- # normal cases
520
+ # normal cases
521
521
 
522
- thing = check_method_multiple_option_names({ thing: 123 }, :thing)
523
- assert_equal 123, thing
522
+ thing = check_method_multiple_option_names({ thing: 123 }, :thing)
523
+ assert_equal 123, thing
524
524
 
525
525
 
526
- thing = check_method_multiple_option_names({ thing: 123 }, :thingy, allow_nil: true)
527
- assert_nil thing
526
+ thing = check_method_multiple_option_names({ thing: 123 }, :thingy, allow_nil: true)
527
+ assert_nil thing
528
528
 
529
529
 
530
- begin
531
- check_method_multiple_option_names({ thing: 123 }, :thingy)
530
+ begin
531
+ check_method_multiple_option_names({ thing: 123 }, :thingy)
532
532
 
533
- assert(false, 'should not get here')
534
- rescue ArgumentError => ax
533
+ assert(false, 'should not get here')
534
+ rescue ArgumentError => ax
535
535
 
536
- assert_equal "option ':thingy' may not be nil", ax.message
537
- rescue => x
536
+ assert_equal "option ':thingy' may not be nil", ax.message
537
+ rescue => x
538
538
 
539
- assert(false, "wrong exception type #{x.class}) (with message '#{x.message}'")
540
- end
539
+ assert(false, "wrong exception type #{x.class}) (with message '#{x.message}'")
540
+ end
541
541
 
542
542
 
543
- # multiple-name cases
543
+ # multiple-name cases
544
544
 
545
545
 
546
- thing = check_method_multiple_option_names({ thing: 123 }, [ :thingy, :thing ])
547
- assert_equal 123, thing
546
+ thing = check_method_multiple_option_names({ thing: 123 }, [ :thingy, :thing ])
547
+ assert_equal 123, thing
548
548
 
549
549
 
550
- thing = check_method_multiple_option_names({ thing: 123 }, [ :thingy, :Thingy ], allow_nil: true)
551
- assert_nil thing
550
+ thing = check_method_multiple_option_names({ thing: 123 }, [ :thingy, :Thingy ], allow_nil: true)
551
+ assert_nil thing
552
552
 
553
553
 
554
- begin
555
- check_method_multiple_option_names({ thing: 123 }, [ :thingy, :Thingy ])
554
+ begin
555
+ check_method_multiple_option_names({ thing: 123 }, [ :thingy, :Thingy ])
556
556
 
557
- assert(false, 'should not get here')
558
- rescue ArgumentError => ax
557
+ assert(false, 'should not get here')
558
+ rescue ArgumentError => ax
559
559
 
560
- assert_equal "option ':thingy' may not be nil", ax.message
561
- rescue => x
560
+ assert_equal "option ':thingy' may not be nil", ax.message
561
+ rescue => x
562
562
 
563
- assert(false, "wrong exception type #{x.class}) (with message '#{x.message}'")
564
- end
563
+ assert(false, "wrong exception type #{x.class}) (with message '#{x.message}'")
564
+ end
565
565
 
566
- assert_raise_with_message(::ArgumentError, "option ':thingy' may not be nil") { check_option({ thing: 123 }, [ :thingy, :Thingy ]) }
567
- assert_raise_with_message(::ArgumentError, "option ':Thingy' may not be nil") { check_option({ thing: 123 }, [ :Thingy, :thingy ]) }
566
+ assert_raise_with_message(::ArgumentError, "option ':thingy' may not be nil") { check_option({ thing: 123 }, [ :thingy, :Thingy ]) }
567
+ assert_raise_with_message(::ArgumentError, "option ':Thingy' may not be nil") { check_option({ thing: 123 }, [ :Thingy, :thingy ]) }
568
568
 
569
- # multiple-name cases where several present
569
+ # multiple-name cases where several present
570
570
 
571
- assert_equal 123, check_method_multiple_option_names({ thing: 123, thingy: 45 }, [ :thing, :thingy ])
572
- assert_equal 45, check_method_multiple_option_names({ thing: 123, thingy: 45 }, [ :thingy, :thing ])
571
+ assert_equal 123, check_method_multiple_option_names({ thing: 123, thingy: 45 }, [ :thing, :thingy ])
572
+ assert_equal 45, check_method_multiple_option_names({ thing: 123, thingy: 45 }, [ :thingy, :thing ])
573
573
 
574
- assert_equal 123, check_method_multiple_option_names({ thing: 123, thingy: 45 }, [ :Thingy, :thing, :thingy ])
575
- assert_equal 45, check_method_multiple_option_names({ thing: 123, thingy: 45 }, [ :Thingy, :thingy, :thing ])
576
- end
574
+ assert_equal 123, check_method_multiple_option_names({ thing: 123, thingy: 45 }, [ :Thingy, :thing, :thingy ])
575
+ assert_equal 45, check_method_multiple_option_names({ thing: 123, thingy: 45 }, [ :Thingy, :thingy, :thing ])
576
+ end
577
577
 
578
- # test strip_str_whitespace
578
+ # test strip_str_whitespace
579
579
 
580
- def check_method_strip_str_whitespace v, name, options = {}, &block
580
+ def check_method_strip_str_whitespace v, name, options = {}, &block
581
581
 
582
- check_parameter v, name, options, &block
583
- end
582
+ check_parameter v, name, options, &block
583
+ end
584
584
 
585
- def test_strip_str_whitespace
585
+ def test_strip_str_whitespace
586
586
 
587
- assert_equal ' ', check_method_strip_str_whitespace(' ', 's')
588
- assert_equal ' ', check_method_strip_str_whitespace(' ', 's', strip_str_whitespace: false)
589
- assert_equal ' ', check_method_strip_str_whitespace(' ', 's', reject_empty: true, strip_str_whitespace: false)
590
- assert_equal '', check_method_strip_str_whitespace(' ', 's', strip_str_whitespace: true)
591
- assert_equal 'abc', check_method_strip_str_whitespace("\tabc ", 's', strip_str_whitespace: true)
587
+ assert_equal ' ', check_method_strip_str_whitespace(' ', 's')
588
+ assert_equal ' ', check_method_strip_str_whitespace(' ', 's', strip_str_whitespace: false)
589
+ assert_equal ' ', check_method_strip_str_whitespace(' ', 's', reject_empty: true, strip_str_whitespace: false)
590
+ assert_equal '', check_method_strip_str_whitespace(' ', 's', strip_str_whitespace: true)
591
+ assert_equal 'abc', check_method_strip_str_whitespace("\tabc ", 's', strip_str_whitespace: true)
592
592
 
593
- assert_raise_with_message(::ArgumentError, /param.*s.*(?:may|must) not be empty/) { check_method_strip_str_whitespace('', 's', reject_empty: true) }
594
- assert_raise_with_message(::ArgumentError, /param.*s.*(?:may|must) not be empty/) { check_method_strip_str_whitespace(' ', 's', reject_empty: true, strip_str_whitespace: true) }
595
- end
593
+ assert_raise_with_message(::ArgumentError, /param.*s.*(?:may|must) not be empty/) { check_method_strip_str_whitespace('', 's', reject_empty: true) }
594
+ assert_raise_with_message(::ArgumentError, /param.*s.*(?:may|must) not be empty/) { check_method_strip_str_whitespace(' ', 's', reject_empty: true, strip_str_whitespace: true) }
595
+ end
596
596
 
597
597
 
598
- # test_allow_nil
598
+ # test_allow_nil
599
599
 
600
- def test_allow_nil
600
+ def test_allow_nil
601
601
 
602
- assert_raise_with_message(::ArgumentError, /parameter .*the_param.* may not be nil/) { check_parameter(nil, 'the_param') }
602
+ assert_raise_with_message(::ArgumentError, /parameter .*the_param.* may not be nil/) { check_parameter(nil, 'the_param') }
603
603
 
604
- assert_nil(check_parameter(nil, 'the_param', allow_nil: true))
604
+ assert_nil(check_parameter(nil, 'the_param', allow_nil: true))
605
605
 
606
- assert_nil(check_parameter(nil, 'the_param', nil: true))
607
- end
606
+ assert_nil(check_parameter(nil, 'the_param', nil: true))
607
+ end
608
608
 
609
609
 
610
- # test_ignore_case
610
+ # test_ignore_case
611
611
 
612
- def test_ignore_case
612
+ def test_ignore_case
613
613
 
614
- assert_not_nil check_parameter('TheString', 'the_param', values: [ 'TheString', 'the-string' ])
614
+ assert_not_nil check_parameter('TheString', 'the_param', values: [ 'TheString', 'the-string' ])
615
615
 
616
- assert_raise_with_message(::ArgumentError, /parameter.*the_param.*not found.*values/) { check_parameter('THESTRING', 'the_param', values: [ 'TheString', 'the-string' ]) }
616
+ assert_raise_with_message(::ArgumentError, /parameter.*the_param.*not found.*values/) { check_parameter('THESTRING', 'the_param', values: [ 'TheString', 'the-string' ]) }
617
617
 
618
- assert_not_nil check_parameter('TheString', 'the_param', values: [ 'THESTRING', 'the-string' ], ignore_case: true)
619
- end
618
+ assert_not_nil check_parameter('TheString', 'the_param', values: [ 'THESTRING', 'the-string' ], ignore_case: true)
619
+ end
620
620
 
621
- def test_ignore_case_in_array
621
+ def test_ignore_case_in_array
622
622
 
623
- assert_not_nil check_parameter([ 'abc', 'def' ], 'the_param', values: [ [ 'ABC', 'DEF' ], [ 'abc', 'def' ] ])
623
+ assert_not_nil check_parameter([ 'abc', 'def' ], 'the_param', values: [ [ 'ABC', 'DEF' ], [ 'abc', 'def' ] ])
624
624
 
625
- assert_raise_with_message(::ArgumentError, /parameter.*the_param.*not found.*values/) { check_parameter([ 'Abc', 'Def' ], 'the_param', values: [ [ 'ABC', 'DEF' ], [ 'abc', 'def' ] ]) }
625
+ assert_raise_with_message(::ArgumentError, /parameter.*the_param.*not found.*values/) { check_parameter([ 'Abc', 'Def' ], 'the_param', values: [ [ 'ABC', 'DEF' ], [ 'abc', 'def' ] ]) }
626
626
 
627
- assert_not_nil check_parameter([ 'Abc', 'Def' ], 'the_param', values: [ [ 'ABC', 'DEF' ], [ 'abc', 'def' ] ], ignore_case: true)
627
+ assert_not_nil check_parameter([ 'Abc', 'Def' ], 'the_param', values: [ [ 'ABC', 'DEF' ], [ 'abc', 'def' ] ], ignore_case: true)
628
628
 
629
- assert_raise_with_message(::ArgumentError, /parameter.*the_param.*not found.*values/) { check_parameter([ 'Def', 'Abc' ], 'the_param', values: [ [ 'ABC', 'DEF' ], [ 'abc', 'def' ] ], ignore_case: true) }
629
+ assert_raise_with_message(::ArgumentError, /parameter.*the_param.*not found.*values/) { check_parameter([ 'Def', 'Abc' ], 'the_param', values: [ [ 'ABC', 'DEF' ], [ 'abc', 'def' ] ], ignore_case: true) }
630
630
 
631
- end
631
+ end
632
632
 
633
- def test_ignore_case_and_order_in_array
633
+ def test_ignore_case_and_order_in_array
634
634
 
635
- assert_not_nil check_parameter([ 'Def', 'Abc', 'Ghi' ], 'the_param', values: [ [ 'GHI', 'ABC', 'DEF' ], [ 'ghi', 'abc', 'def' ] ], ignore_case: true, ignore_order: true)
636
- end
635
+ assert_not_nil check_parameter([ 'Def', 'Abc', 'Ghi' ], 'the_param', values: [ [ 'GHI', 'ABC', 'DEF' ], [ 'ghi', 'abc', 'def' ] ], ignore_case: true, ignore_order: true)
636
+ end
637
637
 
638
- def test_ignore_order_in_array
638
+ def test_ignore_order_in_array
639
639
 
640
- assert_raise(::ArgumentError) { check_parameter([ 'abc', 'def', 'ghi' ], 'the_param', values: [ [ 'ghi', 'def', 'abc' ], [ 'ghi', 'abc', 'def' ] ]) }
640
+ assert_raise(::ArgumentError) { check_parameter([ 'abc', 'def', 'ghi' ], 'the_param', values: [ [ 'ghi', 'def', 'abc' ], [ 'ghi', 'abc', 'def' ] ]) }
641
641
 
642
- assert_not_nil check_parameter([ 'abc', 'def', 'ghi' ], 'the_param', values: [ [ 'ghi', 'def', 'abc' ], [ 'ghi', 'abc', 'def' ] ], ignore_order: true)
643
- end
642
+ assert_not_nil check_parameter([ 'abc', 'def', 'ghi' ], 'the_param', values: [ [ 'ghi', 'def', 'abc' ], [ 'ghi', 'abc', 'def' ] ], ignore_order: true)
643
+ end
644
644
  end
645
645