xqsr3 0.38.1.1 → 0.39.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +15 -6
  3. data/examples/count_word_frequencies.md +13 -13
  4. data/examples/count_word_frequencies.rb +5 -5
  5. data/lib/xqsr3/array_utilities/join_with_or.rb +53 -54
  6. data/lib/xqsr3/array_utilities.rb +2 -2
  7. data/lib/xqsr3/command_line_utilities/map_option_string.rb +66 -67
  8. data/lib/xqsr3/command_line_utilities.rb +2 -2
  9. data/lib/xqsr3/containers/frequency_map.rb +405 -404
  10. data/lib/xqsr3/containers/multi_map.rb +454 -453
  11. data/lib/xqsr3/containers.rb +3 -3
  12. data/lib/xqsr3/conversion/bool_parser.rb +56 -57
  13. data/lib/xqsr3/conversion/integer_parser.rb +92 -93
  14. data/lib/xqsr3/conversion.rb +3 -3
  15. data/lib/xqsr3/diagnostics/exception_utilities.rb +152 -151
  16. data/lib/xqsr3/diagnostics/exceptions/with_cause.rb +99 -95
  17. data/lib/xqsr3/diagnostics/inspect_builder.rb +86 -86
  18. data/lib/xqsr3/diagnostics.rb +3 -3
  19. data/lib/xqsr3/doc_.rb +136 -136
  20. data/lib/xqsr3/extensions/array/join_with_or.rb +9 -9
  21. data/lib/xqsr3/extensions/enumerable/collect_with_index.rb +18 -17
  22. data/lib/xqsr3/extensions/enumerable/detect_map.rb +41 -41
  23. data/lib/xqsr3/extensions/enumerable/unique.rb +32 -31
  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 +34 -34
  33. data/lib/xqsr3/extensions/kernel/integer.rb +26 -26
  34. data/lib/xqsr3/extensions/kernel/raise_with_options.rb +15 -14
  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 -5
  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 -2
  41. data/lib/xqsr3/extensions/string/starts_with.rb +1 -1
  42. data/lib/xqsr3/extensions/string/to_bool.rb +8 -9
  43. data/lib/xqsr3/extensions/string/to_symbol.rb +1 -1
  44. data/lib/xqsr3/extensions/string/truncate.rb +1 -2
  45. data/lib/xqsr3/extensions/test/unit/assert_eql.rb +7 -7
  46. data/lib/xqsr3/extensions/test/unit/assert_false.rb +6 -7
  47. data/lib/xqsr3/extensions/test/unit/assert_not.rb +6 -7
  48. data/lib/xqsr3/extensions/test/unit/assert_not_eql.rb +7 -7
  49. data/lib/xqsr3/extensions/test/unit/assert_raise_with_message.rb +61 -62
  50. data/lib/xqsr3/extensions/test/unit/assert_subclass_of.rb +7 -8
  51. data/lib/xqsr3/extensions/test/unit/assert_superclass_of.rb +7 -8
  52. data/lib/xqsr3/extensions/test/unit/assert_true.rb +6 -7
  53. data/lib/xqsr3/extensions/test/unit/assert_type_has_instance_methods.rb +36 -38
  54. data/lib/xqsr3/extensions.rb +5 -5
  55. data/lib/xqsr3/hash_utilities/deep_transform.rb +71 -71
  56. data/lib/xqsr3/hash_utilities/key_matching.rb +82 -82
  57. data/lib/xqsr3/hash_utilities.rb +3 -3
  58. data/lib/xqsr3/internal_/test_unit_version_.rb +130 -88
  59. data/lib/xqsr3/io/writelines.rb +125 -125
  60. data/lib/xqsr3/quality/parameter_checking.rb +452 -453
  61. data/lib/xqsr3/quality.rb +2 -2
  62. data/lib/xqsr3/string_utilities/ends_with.rb +64 -64
  63. data/lib/xqsr3/string_utilities/nil_if_empty.rb +33 -34
  64. data/lib/xqsr3/string_utilities/nil_if_whitespace.rb +35 -35
  65. data/lib/xqsr3/string_utilities/quote_if.rb +55 -56
  66. data/lib/xqsr3/string_utilities/starts_with.rb +64 -64
  67. data/lib/xqsr3/string_utilities/to_symbol.rb +80 -80
  68. data/lib/xqsr3/string_utilities/truncate.rb +60 -61
  69. data/lib/xqsr3/string_utilities.rb +8 -8
  70. data/lib/xqsr3/version.rb +19 -20
  71. data/test/performance/frequency_map.rb +13 -27
  72. data/test/scratch/test_assert_raise_with_message.rb +12 -13
  73. data/test/unit/array_utilities/tc_join_with_or.rb +140 -142
  74. data/test/unit/command_line_utilities/tc_map_option_string.rb +18 -18
  75. data/test/unit/containers/tc_frequency_map.rb +607 -554
  76. data/test/unit/containers/tc_multi_map.rb +573 -522
  77. data/test/unit/conversion/tc_integer_parser.rb +73 -73
  78. data/test/unit/conversion/tc_to_bool.rb +26 -26
  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_hash.rb +1 -1
  87. data/test/unit/extensions/hash/tc_slice.rb +14 -14
  88. data/test/unit/extensions/integer/tc_to_s_grp.rb +60 -0
  89. data/test/unit/extensions/integer/ts_all.rb +12 -0
  90. data/test/unit/extensions/io/tc_writelines.rb +77 -77
  91. data/test/unit/extensions/kernel/tc_integer.rb +75 -75
  92. data/test/unit/extensions/kernel/tc_raise_with_options.rb +155 -155
  93. data/test/unit/extensions/object/tc_inspect.rb +51 -51
  94. data/test/unit/extensions/string/tc_bool.tb +24 -24
  95. data/test/unit/extensions/string/tc_ends_with.rb +53 -53
  96. data/test/unit/extensions/string/tc_map_option_string.rb +15 -15
  97. data/test/unit/extensions/string/tc_nil_if_empty.rb +8 -8
  98. data/test/unit/extensions/string/tc_nil_if_whitespace.rb +8 -8
  99. data/test/unit/extensions/string/tc_quote_if.rb +18 -18
  100. data/test/unit/extensions/string/tc_starts_with.rb +53 -53
  101. data/test/unit/extensions/string/tc_to_symbol.rb +26 -26
  102. data/test/unit/extensions/string/tc_truncate.rb +18 -18
  103. data/test/unit/extensions/test/unit/tc_assert_raise_with_message.rb +16 -16
  104. data/test/unit/extensions/test/unit/tc_assert_subclass_of.rb +9 -9
  105. data/test/unit/extensions/test/unit/tc_assert_superclass_of.rb +9 -9
  106. data/test/unit/hash_utilities/tc_has_match.rb +70 -70
  107. data/test/unit/hash_utilities/tc_match.rb +83 -83
  108. data/test/unit/io/tc_writelines.rb +106 -108
  109. data/test/unit/quality/tc_parameter_checking.rb +390 -390
  110. data/test/unit/string_utilities/tc_truncate.rb +28 -28
  111. data/test/unit/tc_version.rb +15 -15
  112. metadata +6 -2
@@ -8,235 +8,235 @@ require 'test/unit'
8
8
 
9
9
  class Test_X_Kernel_raise_with_options < Test::Unit::TestCase
10
10
 
11
- OS_IS_WINDOWS = (RUBY_PLATFORM =~ /(mswin|mingw|bccwin|wince)/i) ? true : false
12
- LINE_NUM_RE = OS_IS_WINDOWS ? /.+:(\d+):/ : /^[^:]+:(\d+)/
11
+ OS_IS_WINDOWS = (RUBY_PLATFORM =~ /(mswin|mingw|bccwin|wince)/i) ? true : false
12
+ LINE_NUM_RE = OS_IS_WINDOWS ? /.+:(\d+):/ : /^[^:]+:(\d+)/
13
13
 
14
- class ArgumentErrorWithOptions < ArgumentError
14
+ class ArgumentErrorWithOptions < ArgumentError
15
15
 
16
- def initialize(message = nil, **options)
16
+ def initialize(message = nil, **options)
17
17
 
18
- super(message)
19
- options ||= {}
20
- @options = options
21
- end
22
- attr_reader :options
18
+ super(message)
19
+ options ||= {}
20
+ @options = options
21
+ end
22
+ attr_reader :options
23
23
 
24
- def exception(msg = nil, options = nil)
24
+ def exception(msg = nil, options = nil)
25
25
 
26
- return self if msg.nil?
27
- return self if msg.object_id == self.object_id
26
+ return self if msg.nil?
27
+ return self if msg.object_id == self.object_id
28
28
 
29
- msg ||= self.message
30
- options ||= {}
31
- r = self.class.new msg, **self.options.merge(options)
32
- r
33
- end
34
- end
29
+ msg ||= self.message
30
+ options ||= {}
31
+ r = self.class.new msg, **self.options.merge(options)
32
+ r
33
+ end
34
+ end
35
35
 
36
- def execute(&block)
36
+ def execute(&block)
37
37
 
38
- block.call
39
- end
38
+ block.call
39
+ end
40
40
 
41
- def test_0
41
+ def test_0
42
42
 
43
- # standard raise: message-only
44
- begin
43
+ # standard raise: message-only
44
+ begin
45
45
 
46
- raise "abc"
46
+ raise "abc"
47
47
 
48
- assert false, "should not get here"
49
- rescue => x
48
+ assert false, "should not get here"
49
+ rescue => x
50
50
 
51
- assert_kind_of(RuntimeError, x)
52
- assert_equal "abc", x.message
53
- end
51
+ assert_kind_of(RuntimeError, x)
52
+ assert_equal "abc", x.message
53
+ end
54
54
 
55
- # RWO: message-only
56
- begin
55
+ # RWO: message-only
56
+ begin
57
57
 
58
- raise_with_options "abc"
58
+ raise_with_options "abc"
59
59
 
60
- assert false, "should not get here"
61
- rescue => x
60
+ assert false, "should not get here"
61
+ rescue => x
62
62
 
63
- assert_kind_of(RuntimeError, x)
64
- assert_equal "abc", x.message
65
- end
66
- end
63
+ assert_kind_of(RuntimeError, x)
64
+ assert_equal "abc", x.message
65
+ end
66
+ end
67
67
 
68
- def test_1
68
+ def test_1
69
69
 
70
- # standard raise: class
71
- begin
70
+ # standard raise: class
71
+ begin
72
72
 
73
- raise ArgumentError
73
+ raise ArgumentError
74
74
 
75
- assert false, "should not get here"
76
- rescue => x
75
+ assert false, "should not get here"
76
+ rescue => x
77
77
 
78
- assert_kind_of(ArgumentError, x)
79
- assert_equal "ArgumentError", x.message
80
- end
78
+ assert_kind_of(ArgumentError, x)
79
+ assert_equal "ArgumentError", x.message
80
+ end
81
81
 
82
- # RWO: class + message
83
- begin
82
+ # RWO: class + message
83
+ begin
84
84
 
85
- raise_with_options ArgumentError
85
+ raise_with_options ArgumentError
86
86
 
87
- assert false, "should not get here"
88
- rescue => x
87
+ assert false, "should not get here"
88
+ rescue => x
89
89
 
90
- assert_kind_of(ArgumentError, x)
91
- assert_equal "ArgumentError", x.message
92
- end
93
- end
90
+ assert_kind_of(ArgumentError, x)
91
+ assert_equal "ArgumentError", x.message
92
+ end
93
+ end
94
94
 
95
- def test_2
95
+ def test_2
96
96
 
97
- # standard raise: class + message
98
- begin
97
+ # standard raise: class + message
98
+ begin
99
99
 
100
- raise ArgumentError, "abc"
100
+ raise ArgumentError, "abc"
101
101
 
102
- assert false, "should not get here"
103
- rescue => x
102
+ assert false, "should not get here"
103
+ rescue => x
104
104
 
105
- assert_kind_of(ArgumentError, x)
106
- assert_equal "abc", x.message
107
- end
105
+ assert_kind_of(ArgumentError, x)
106
+ assert_equal "abc", x.message
107
+ end
108
108
 
109
- # RWO: class + message
110
- begin
109
+ # RWO: class + message
110
+ begin
111
111
 
112
- raise_with_options ArgumentError, "abc"
112
+ raise_with_options ArgumentError, "abc"
113
113
 
114
- assert false, "should not get here"
115
- rescue => x
114
+ assert false, "should not get here"
115
+ rescue => x
116
116
 
117
- assert_kind_of(ArgumentError, x)
118
- assert_equal "abc", x.message
119
- end
120
- end
117
+ assert_kind_of(ArgumentError, x)
118
+ assert_equal "abc", x.message
119
+ end
120
+ end
121
121
 
122
- def test_2_b_no_options
122
+ def test_2_b_no_options
123
123
 
124
- # standard raise: class + message
125
- begin
124
+ # standard raise: class + message
125
+ begin
126
126
 
127
- raise ArgumentErrorWithOptions, "abc"
127
+ raise ArgumentErrorWithOptions, "abc"
128
128
 
129
- assert false, "should not get here"
130
- rescue => x
129
+ assert false, "should not get here"
130
+ rescue => x
131
131
 
132
- assert_kind_of(ArgumentError, x)
133
- assert_equal "abc", x.message
134
- end
132
+ assert_kind_of(ArgumentError, x)
133
+ assert_equal "abc", x.message
134
+ end
135
135
 
136
- # RWO: class + message
137
- begin
136
+ # RWO: class + message
137
+ begin
138
138
 
139
- raise_with_options ArgumentErrorWithOptions, "abc"
139
+ raise_with_options ArgumentErrorWithOptions, "abc"
140
140
 
141
- assert false, "should not get here"
142
- rescue => x
141
+ assert false, "should not get here"
142
+ rescue => x
143
143
 
144
- assert_kind_of(ArgumentError, x)
145
- assert_equal "abc", x.message
146
- end
147
- end
144
+ assert_kind_of(ArgumentError, x)
145
+ assert_equal "abc", x.message
146
+ end
147
+ end
148
148
 
149
- def test_2_b_with_options
149
+ def test_2_b_with_options
150
150
 
151
- # standard raise: class + message + options
152
- begin
151
+ # standard raise: class + message + options
152
+ begin
153
153
 
154
- raise ArgumentErrorWithOptions.new("abc", blah: :blech, id: 23)
154
+ raise ArgumentErrorWithOptions.new("abc", blah: :blech, id: 23)
155
155
 
156
- assert false, "should not get here"
157
- rescue => x
156
+ assert false, "should not get here"
157
+ rescue => x
158
158
 
159
- assert_kind_of(ArgumentError, x)
160
- assert_equal "abc", x.message
161
- assert_equal ({ :blah => :blech, :id => 23 }), x.options
162
- end
159
+ assert_kind_of(ArgumentError, x)
160
+ assert_equal "abc", x.message
161
+ assert_equal ({ :blah => :blech, :id => 23 }), x.options
162
+ end
163
163
 
164
- # RWO: class + message + options (raise-way)
165
- begin
164
+ # RWO: class + message + options (raise-way)
165
+ begin
166
166
 
167
- raise_with_options ArgumentErrorWithOptions.new("abc", blah: :blech, id: 23)
167
+ raise_with_options ArgumentErrorWithOptions.new("abc", blah: :blech, id: 23)
168
168
 
169
- assert false, "should not get here"
170
- rescue => x
169
+ assert false, "should not get here"
170
+ rescue => x
171
171
 
172
- assert_kind_of(ArgumentError, x)
173
- assert_equal "abc", x.message
174
- assert_equal ({ :blah => :blech, :id => 23 }), x.options
175
- end
172
+ assert_kind_of(ArgumentError, x)
173
+ assert_equal "abc", x.message
174
+ assert_equal ({ :blah => :blech, :id => 23 }), x.options
175
+ end
176
176
 
177
- # RWO: class + message + options (raise_with_options-way)
178
- begin
177
+ # RWO: class + message + options (raise_with_options-way)
178
+ begin
179
179
 
180
- raise_with_options ArgumentErrorWithOptions, "abc", blah: :blech, id: 23
180
+ raise_with_options ArgumentErrorWithOptions, "abc", blah: :blech, id: 23
181
181
 
182
- assert false, "should not get here"
183
- rescue => x
182
+ assert false, "should not get here"
183
+ rescue => x
184
184
 
185
- assert_kind_of(ArgumentError, x)
186
- assert_equal "abc", x.message
187
- assert_equal ({ :blah => :blech, :id => 23 }), x.options
188
- end
189
- end
185
+ assert_kind_of(ArgumentError, x)
186
+ assert_equal "abc", x.message
187
+ assert_equal ({ :blah => :blech, :id => 23 }), x.options
188
+ end
189
+ end
190
190
 
191
191
 
192
- def test_with_backtrace
192
+ def test_with_backtrace
193
193
 
194
- line_number = nil
194
+ line_number = nil
195
195
 
196
- # standard raise: class + message + stack trace
197
- begin
196
+ # standard raise: class + message + stack trace
197
+ begin
198
198
 
199
- begin
199
+ begin
200
200
 
201
- execute { line_number = __LINE__; raise ArgumentError }
202
- rescue => x
201
+ execute { line_number = __LINE__; raise ArgumentError }
202
+ rescue => x
203
203
 
204
- raise x, "abc", x.backtrace
205
- end
204
+ raise x, "abc", x.backtrace
205
+ end
206
206
 
207
- assert false, "should not get here"
208
- rescue => x
207
+ assert false, "should not get here"
208
+ rescue => x
209
209
 
210
- assert_kind_of(ArgumentError, x)
211
- assert_equal "abc", x.message
210
+ assert_kind_of(ArgumentError, x)
211
+ assert_equal "abc", x.message
212
212
 
213
- assert $@[0] =~ LINE_NUM_RE
214
- assert_equal line_number.to_s, $1.to_s
215
- end
213
+ assert $@[0] =~ LINE_NUM_RE
214
+ assert_equal line_number.to_s, $1.to_s
215
+ end
216
216
 
217
- # RWO: class + message + stack trace
218
- begin
217
+ # RWO: class + message + stack trace
218
+ begin
219
219
 
220
- begin
220
+ begin
221
221
 
222
- execute { line_number = __LINE__; raise_with_options ArgumentErrorWithOptions, blah: :blech, id: 23 }
222
+ execute { line_number = __LINE__; raise_with_options ArgumentErrorWithOptions, blah: :blech, id: 23 }
223
223
 
224
- assert false, "should not get here"
225
- rescue => x
224
+ assert false, "should not get here"
225
+ rescue => x
226
226
 
227
- raise x, "abc", x.backtrace
228
- end
227
+ raise x, "abc", x.backtrace
228
+ end
229
229
 
230
- assert false, "should not get here"
231
- rescue => x
230
+ assert false, "should not get here"
231
+ rescue => x
232
232
 
233
- assert_kind_of(ArgumentError, x)
234
- assert_equal "abc", x.message
235
- assert_equal ({ :blah => :blech, :id => 23 }), x.options
233
+ assert_kind_of(ArgumentError, x)
234
+ assert_equal "abc", x.message
235
+ assert_equal ({ :blah => :blech, :id => 23 }), x.options
236
236
 
237
- assert $@[0] =~ LINE_NUM_RE
238
- assert_equal line_number.to_s, $1.to_s
239
- end
240
- end
237
+ assert $@[0] =~ LINE_NUM_RE
238
+ assert_equal line_number.to_s, $1.to_s
239
+ end
240
+ end
241
241
  end
242
242
 
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env ruby
1
+ #! /usr/bin/env ruby
2
2
 
3
3
  $:.unshift File.join(File.dirname(__FILE__), '../../../../lib')
4
4
 
@@ -9,92 +9,92 @@ require 'test/unit'
9
9
 
10
10
  class Test_X_Object_inspect < Test::Unit::TestCase
11
11
 
12
- class Example1
12
+ class Example1
13
13
 
14
- include ::Xqsr3::Diagnostics::InspectBuilder
14
+ include ::Xqsr3::Diagnostics::InspectBuilder
15
15
 
16
- def initialize **inspect_options
16
+ def initialize **inspect_options
17
17
 
18
- @alphabet = 'abcdefghijklmnopqrstuvwxyz'
19
- @letters = @alphabet.chars.map { |c| c.upcase }
20
- @inspect_options = inspect_options
21
- end
18
+ @alphabet = 'abcdefghijklmnopqrstuvwxyz'
19
+ @letters = @alphabet.chars.map { |c| c.upcase }
20
+ @inspect_options = inspect_options
21
+ end
22
22
 
23
- def inspect
23
+ def inspect
24
24
 
25
- make_inspect **@inspect_options
26
- end
27
- end
25
+ make_inspect **@inspect_options
26
+ end
27
+ end
28
28
 
29
- class ExampleWithHiddenFields < Example1
29
+ class ExampleWithHiddenFields < Example1
30
30
 
31
- INSPECT_HIDDEN_FIELDS = [ 'letters' ]
32
- end
31
+ INSPECT_HIDDEN_FIELDS = [ 'letters' ]
32
+ end
33
33
 
34
- def test_default_use
34
+ def test_default_use
35
35
 
36
- ex = Example1.new
36
+ ex = Example1.new
37
37
 
38
- assert_match /\A#<Test_X_Object_inspect::Example1:0x\d+>\z/, ex.inspect
38
+ assert_match /\A#<Test_X_Object_inspect::Example1:0x\d+>\z/, ex.inspect
39
39
 
40
- ex2 = ExampleWithHiddenFields.new
40
+ ex2 = ExampleWithHiddenFields.new
41
41
 
42
- assert_match /\A#<Test_X_Object_inspect::ExampleWithHiddenFields:0x\d+>\z/, ex2.inspect
43
- end
42
+ assert_match /\A#<Test_X_Object_inspect::ExampleWithHiddenFields:0x\d+>\z/, ex2.inspect
43
+ end
44
44
 
45
- def test_no_class
45
+ def test_no_class
46
46
 
47
- ex = Example1.new(no_class: true)
47
+ ex = Example1.new(no_class: true)
48
48
 
49
- assert_match /\A#<0x\d+>\z/, ex.inspect
49
+ assert_match /\A#<0x\d+>\z/, ex.inspect
50
50
 
51
- ex2 = ExampleWithHiddenFields.new(no_class: true)
51
+ ex2 = ExampleWithHiddenFields.new(no_class: true)
52
52
 
53
- assert_match /\A#<0x\d+>\z/, ex2.inspect
54
- end
53
+ assert_match /\A#<0x\d+>\z/, ex2.inspect
54
+ end
55
55
 
56
- def test_no_object_id
56
+ def test_no_object_id
57
57
 
58
- ex = Example1.new(no_object_id: true)
58
+ ex = Example1.new(no_object_id: true)
59
59
 
60
- assert_match /\A#<Test_X_Object_inspect::Example1>\z/, ex.inspect
60
+ assert_match /\A#<Test_X_Object_inspect::Example1>\z/, ex.inspect
61
61
 
62
- ex2 = ExampleWithHiddenFields.new(no_object_id: true)
62
+ ex2 = ExampleWithHiddenFields.new(no_object_id: true)
63
63
 
64
- assert_match /\A#<Test_X_Object_inspect::ExampleWithHiddenFields>\z/, ex2.inspect
65
- end
64
+ assert_match /\A#<Test_X_Object_inspect::ExampleWithHiddenFields>\z/, ex2.inspect
65
+ end
66
66
 
67
- def test_show_fields
67
+ def test_show_fields
68
68
 
69
- ex = Example1.new(show_fields: true)
69
+ ex = Example1.new(show_fields: true)
70
70
 
71
- assert_match /\A#<Test_X_Object_inspect::Example1:0x\d+:\s*@alphabet\(String\)='abcdefghijklmnopqrstuvwxyz';\s*@inspect_options.*;\s*@letters.*>\z/, ex.inspect
71
+ assert_match /\A#<Test_X_Object_inspect::Example1:0x\d+:\s*@alphabet\(String\)='abcdefghijklmnopqrstuvwxyz';\s*@inspect_options.*;\s*@letters.*>\z/, ex.inspect
72
72
 
73
- ex2 = ExampleWithHiddenFields.new(show_fields: true)
73
+ ex2 = ExampleWithHiddenFields.new(show_fields: true)
74
74
 
75
- assert_match /\A#<Test_X_Object_inspect::ExampleWithHiddenFields:0x\d+:\s*@alphabet\(String\)='abcdefghijklmnopqrstuvwxyz';\s*@inspect_options\(.+\)=[^;]+>\z/, ex2.inspect
76
- end
75
+ assert_match /\A#<Test_X_Object_inspect::ExampleWithHiddenFields:0x\d+:\s*@alphabet\(String\)='abcdefghijklmnopqrstuvwxyz';\s*@inspect_options\(.+\)=[^;]+>\z/, ex2.inspect
76
+ end
77
77
 
78
- def test_show_fields_hidden
78
+ def test_show_fields_hidden
79
79
 
80
- ex = Example1.new(show_fields: true, hidden_fields: [ 'inspect_options' ])
80
+ ex = Example1.new(show_fields: true, hidden_fields: [ 'inspect_options' ])
81
81
 
82
- assert_match /\A#<Test_X_Object_inspect::Example1:0x\d+:\s*@alphabet\(String\)='abcdefghijklmnopqrstuvwxyz';\s*@letters.*>\z/, ex.inspect
82
+ assert_match /\A#<Test_X_Object_inspect::Example1:0x\d+:\s*@alphabet\(String\)='abcdefghijklmnopqrstuvwxyz';\s*@letters.*>\z/, ex.inspect
83
83
 
84
- ex2 = ExampleWithHiddenFields.new(show_fields: true, hidden_fields: [ 'inspect_options' ])
84
+ ex2 = ExampleWithHiddenFields.new(show_fields: true, hidden_fields: [ 'inspect_options' ])
85
85
 
86
- assert_match /\A#<Test_X_Object_inspect::ExampleWithHiddenFields:0x\d+:\s*@alphabet\(String\)='abcdefghijklmnopqrstuvwxyz'>\z/, ex2.inspect
87
- end
86
+ assert_match /\A#<Test_X_Object_inspect::ExampleWithHiddenFields:0x\d+:\s*@alphabet\(String\)='abcdefghijklmnopqrstuvwxyz'>\z/, ex2.inspect
87
+ end
88
88
 
89
- def test_show_fields_truncated
89
+ def test_show_fields_truncated
90
90
 
91
- ex = Example1.new(show_fields: true, truncate_width: 10)
91
+ ex = Example1.new(show_fields: true, truncate_width: 10)
92
92
 
93
- assert_match /\A#<Test_X_Object_inspect::Example1:0x\d+:\s*@alphabet\(String\)='abcdefg...';\s*@inspect_options.*;\s*@letters.*>\z/, ex.inspect
93
+ assert_match /\A#<Test_X_Object_inspect::Example1:0x\d+:\s*@alphabet\(String\)='abcdefg...';\s*@inspect_options.*;\s*@letters.*>\z/, ex.inspect
94
94
 
95
- ex2 = ExampleWithHiddenFields.new(show_fields: true, truncate_width: 10)
95
+ ex2 = ExampleWithHiddenFields.new(show_fields: true, truncate_width: 10)
96
96
 
97
- assert_match /\A#<Test_X_Object_inspect::ExampleWithHiddenFields:0x\d+:\s*@alphabet\(String\)='abcdefg...';\s*@inspect_options.*>\z/, ex2.inspect
98
- end
97
+ assert_match /\A#<Test_X_Object_inspect::ExampleWithHiddenFields:0x\d+:\s*@alphabet\(String\)='abcdefg...';\s*@inspect_options.*>\z/, ex2.inspect
98
+ end
99
99
  end
100
100
 
@@ -9,36 +9,36 @@ require 'test/unit'
9
9
 
10
10
  class Test_String_to_bool < Test::Unit::TestCase
11
11
 
12
- def test_parse_normal
12
+ def test_parse_normal
13
13
 
14
- assert_true 'true'.to_bool
15
- assert_false 'false'.to_bool
16
- end
14
+ assert_true 'true'.to_bool
15
+ assert_false 'false'.to_bool
16
+ end
17
17
 
18
- def test_parse_custom_true_false
18
+ def test_parse_custom_true_false
19
19
 
20
- true_values = [ 'affirmative', 'yup' ]
21
- false_values = [ 'negative', 'nope' ]
20
+ true_values = [ 'affirmative', 'yup' ]
21
+ false_values = [ 'negative', 'nope' ]
22
22
 
23
- assert_true 'affirmative'.to_bool true_values: true_values, false_values: false_values
24
- assert_true 'yup'.to_bool true_values: true_values, false_values: false_values
25
- assert_nil 'true'.to_bool true_values: true_values, false_values: false_values
26
- assert_false 'negative'.to_bool true_values: true_values, false_values: false_values
27
- assert_false 'nope'.to_bool true_values: true_values, false_values: false_values
28
- assert_nil 'false'.to_bool true_values: true_values, false_values: false_values
29
- end
23
+ assert_true 'affirmative'.to_bool true_values: true_values, false_values: false_values
24
+ assert_true 'yup'.to_bool true_values: true_values, false_values: false_values
25
+ assert_nil 'true'.to_bool true_values: true_values, false_values: false_values
26
+ assert_false 'negative'.to_bool true_values: true_values, false_values: false_values
27
+ assert_false 'nope'.to_bool true_values: true_values, false_values: false_values
28
+ assert_nil 'false'.to_bool true_values: true_values, false_values: false_values
29
+ end
30
30
 
31
- def test_parse_custom_true_false_regexes
31
+ def test_parse_custom_true_false_regexes
32
32
 
33
- true_values = [ /affirm/, /yup/ ]
34
- false_values = [ 'negative', /no/ ]
33
+ true_values = [ /affirm/, /yup/ ]
34
+ false_values = [ 'negative', /no/ ]
35
35
 
36
- assert_true 'affirmative'.to_bool true_values: true_values, false_values: false_values
37
- assert_true 'yup'.to_bool true_values: true_values, false_values: false_values
38
- assert_nil 'true'.to_bool true_values: true_values, false_values: false_values
39
- assert_false 'negative'.to_bool true_values: true_values, false_values: false_values
40
- assert_false 'nope'.to_bool true_values: true_values, false_values: false_values
41
- assert_nil 'false'.to_bool true_values: true_values, false_values: false_values
42
- end
36
+ assert_true 'affirmative'.to_bool true_values: true_values, false_values: false_values
37
+ assert_true 'yup'.to_bool true_values: true_values, false_values: false_values
38
+ assert_nil 'true'.to_bool true_values: true_values, false_values: false_values
39
+ assert_false 'negative'.to_bool true_values: true_values, false_values: false_values
40
+ assert_false 'nope'.to_bool true_values: true_values, false_values: false_values
41
+ assert_nil 'false'.to_bool true_values: true_values, false_values: false_values
42
+ end
43
43
  end
44
44