xqsr3 0.39.1 → 0.39.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/xqsr3/extensions/hash/except.rb +1 -1
- data/lib/xqsr3/extensions/io/writelines.rb +3 -3
- data/lib/xqsr3/extensions/test/unit/assert_eql.rb +4 -1
- data/lib/xqsr3/extensions/test/unit/assert_false.rb +4 -1
- data/lib/xqsr3/extensions/test/unit/assert_not.rb +4 -1
- data/lib/xqsr3/extensions/test/unit/assert_not_eql.rb +4 -1
- data/lib/xqsr3/extensions/test/unit/assert_raise_with_message.rb +1 -1
- data/lib/xqsr3/extensions/test/unit/assert_subclass_of.rb +4 -1
- data/lib/xqsr3/extensions/test/unit/assert_superclass_of.rb +4 -1
- data/lib/xqsr3/extensions/test/unit/assert_true.rb +4 -1
- data/lib/xqsr3/extensions/test/unit/assert_type_has_instance_methods.rb +4 -1
- data/lib/xqsr3/internal_/test_unit_version_.rb +8 -8
- data/lib/xqsr3/io/writelines.rb +4 -2
- data/lib/xqsr3/version.rb +2 -2
- data/test/unit/containers/tc_frequency_map.rb +2 -2
- data/test/unit/conversion/tc_integer_parser.rb +17 -17
- data/test/unit/diagnostics/exceptions/tc_with_cause.rb +5 -5
- data/test/unit/extensions/enumerable/tc_detect_map.rb +1 -1
- data/test/unit/extensions/hash/tc_except.rb +1 -1
- data/test/unit/extensions/io/tc_writelines.rb +72 -0
- data/test/unit/extensions/kernel/tc_integer.rb +9 -9
- data/test/unit/extensions/object/tc_inspect.rb +13 -13
- data/test/unit/io/tc_writelines.rb +60 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9ed73f4599f60f4dfbbd40d39d1967cccdf74e69b5f317d859128f04777551c
|
4
|
+
data.tar.gz: 07b8984f99e23d99ce1fd1cd05fc5b553ddb587e732d8b6d0deac758c95644f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b78b409d39d78d7e8fc44a31db077e8638d64f91545212ad2ed2921b4a39a5f2d1fc266ffb71ed16b7fb3fd48f947923135144401144942774e93a61938715d3
|
7
|
+
data.tar.gz: a0b0e40fcc75a20cf3f2203920c807819b88270ae1e4cb987166243e829a05a9d1288b7cc1e2923f3895504cf83272cdb89de92be5b053705dcb04be9c63c492
|
@@ -5,7 +5,7 @@
|
|
5
5
|
# Purpose: Adds a writelines() method to the IO class
|
6
6
|
#
|
7
7
|
# Created: 13th April 2007
|
8
|
-
# Updated:
|
8
|
+
# Updated: 12th April 2024
|
9
9
|
#
|
10
10
|
# Home: http://github.com/synesissoftware/xqsr3
|
11
11
|
#
|
@@ -83,8 +83,8 @@ class IO
|
|
83
83
|
arg3 = args[0]
|
84
84
|
arg4 = args[1]
|
85
85
|
|
86
|
-
options[:line_separator] =
|
87
|
-
options[:column_separator] =
|
86
|
+
options[:line_separator] = arg3
|
87
|
+
options[:column_separator] = arg4
|
88
88
|
else
|
89
89
|
|
90
90
|
raise ArgumentError, "wrong number of arguments (given #{2 + args.size}, expected 2..4)"
|
@@ -1,10 +1,13 @@
|
|
1
1
|
|
2
|
+
require 'test/unit/assertions'
|
3
|
+
|
4
|
+
|
2
5
|
module Test
|
3
6
|
module Unit
|
4
7
|
|
5
8
|
module Assertions
|
6
9
|
|
7
|
-
unless
|
10
|
+
unless self.method_defined? :assert_eql
|
8
11
|
|
9
12
|
# Assert that +expected+ and +actual+ have the same hash key, as
|
10
13
|
# evaluated by the instance method +eq?+
|
@@ -1,10 +1,13 @@
|
|
1
1
|
|
2
|
+
require 'test/unit/assertions'
|
3
|
+
|
4
|
+
|
2
5
|
module Test
|
3
6
|
module Unit
|
4
7
|
|
5
8
|
module Assertions
|
6
9
|
|
7
|
-
unless
|
10
|
+
unless self.method_defined? :assert_false
|
8
11
|
|
9
12
|
# Assert that +expression+ is +false+ (and not merely _falsey_)
|
10
13
|
def assert_false(expression, failure_message = '')
|
@@ -1,10 +1,13 @@
|
|
1
1
|
|
2
|
+
require 'test/unit/assertions'
|
3
|
+
|
4
|
+
|
2
5
|
module Test
|
3
6
|
module Unit
|
4
7
|
|
5
8
|
module Assertions
|
6
9
|
|
7
|
-
unless
|
10
|
+
unless self.method_defined? :assert_not
|
8
11
|
|
9
12
|
# Assert that +expression+ is _falsey_
|
10
13
|
def assert_not(expression, failure_message = '')
|
@@ -1,10 +1,13 @@
|
|
1
1
|
|
2
|
+
require 'test/unit/assertions'
|
3
|
+
|
4
|
+
|
2
5
|
module Test
|
3
6
|
module Unit
|
4
7
|
|
5
8
|
module Assertions
|
6
9
|
|
7
|
-
unless
|
10
|
+
unless self.method_defined? :assert_not_eql
|
8
11
|
|
9
12
|
# Assert that +expected+ and +actual+ have different hash keys, as
|
10
13
|
# evaluated by the instance method +eq?+
|
@@ -28,7 +28,7 @@ module Unit
|
|
28
28
|
|
29
29
|
module Assertions
|
30
30
|
|
31
|
-
undef :assert_raise_with_message if
|
31
|
+
undef :assert_raise_with_message if self.method_defined? :assert_raise_with_message
|
32
32
|
|
33
33
|
# Asserts that the attached block raises an exception of one of the
|
34
34
|
# exceptions defined by +type_spec+ and/or has a message matching
|
@@ -1,10 +1,13 @@
|
|
1
1
|
|
2
|
+
require 'test/unit/assertions'
|
3
|
+
|
4
|
+
|
2
5
|
module Test
|
3
6
|
module Unit
|
4
7
|
|
5
8
|
module Assertions
|
6
9
|
|
7
|
-
unless
|
10
|
+
unless self.method_defined? :assert_subclass_of
|
8
11
|
|
9
12
|
# Assert that +tested_class+ is a sub-class of +parent_class+
|
10
13
|
def assert_subclass_of(parent_class, tested_class, failure_message = nil)
|
@@ -1,10 +1,13 @@
|
|
1
1
|
|
2
|
+
require 'test/unit/assertions'
|
3
|
+
|
4
|
+
|
2
5
|
module Test
|
3
6
|
module Unit
|
4
7
|
|
5
8
|
module Assertions
|
6
9
|
|
7
|
-
unless
|
10
|
+
unless self.method_defined? :assert_superclass_of
|
8
11
|
|
9
12
|
# Assert that +tested_class+ is a super-class of +child_class+
|
10
13
|
def assert_superclass_of(child_class, tested_class, failure_message = nil)
|
@@ -1,10 +1,13 @@
|
|
1
1
|
|
2
|
+
require 'test/unit/assertions'
|
3
|
+
|
4
|
+
|
2
5
|
module Test
|
3
6
|
module Unit
|
4
7
|
|
5
8
|
module Assertions
|
6
9
|
|
7
|
-
unless
|
10
|
+
unless self.method_defined? :assert_true
|
8
11
|
|
9
12
|
# Assert that +expression+ is +true+ (and not merely _truey_)
|
10
13
|
def assert_true(expression, failure_message = '')
|
@@ -1,10 +1,13 @@
|
|
1
1
|
|
2
|
+
require 'test/unit/assertions'
|
3
|
+
|
4
|
+
|
2
5
|
module Test
|
3
6
|
module Unit
|
4
7
|
|
5
8
|
module Assertions
|
6
9
|
|
7
|
-
unless
|
10
|
+
unless self.method_defined? :assert_type_has_instance_methods
|
8
11
|
|
9
12
|
# Fails unless the given +type+ responds to all of the messages
|
10
13
|
# given by +message_spec+
|
@@ -6,13 +6,13 @@
|
|
6
6
|
# Test::Unit module
|
7
7
|
#
|
8
8
|
# Created: March 2nd 2019
|
9
|
-
# Updated: 11th
|
9
|
+
# Updated: 11th April 2024
|
10
10
|
#
|
11
11
|
# Home: http://github.com/synesissoftware/xqsr3
|
12
12
|
#
|
13
13
|
# Author: Matthew Wilson
|
14
14
|
#
|
15
|
-
# Copyright (c) 2019-
|
15
|
+
# Copyright (c) 2019-2024, Matthew Wilson and Synesis Information Systems
|
16
16
|
# All rights reserved.
|
17
17
|
#
|
18
18
|
# Redistribution and use in source and binary forms, with or without
|
@@ -66,7 +66,7 @@ begin
|
|
66
66
|
end # module Xqsr3
|
67
67
|
|
68
68
|
# :startdoc:
|
69
|
-
|
69
|
+
rescue LoadError
|
70
70
|
|
71
71
|
# :stopdoc:
|
72
72
|
# @!visibility private
|
@@ -83,13 +83,13 @@ begin
|
|
83
83
|
end # module Xqsr3
|
84
84
|
|
85
85
|
# :startdoc:
|
86
|
-
|
86
|
+
end
|
87
87
|
|
88
|
-
|
88
|
+
# :stopdoc:
|
89
89
|
|
90
|
-
|
91
|
-
|
92
|
-
|
90
|
+
module Xqsr3
|
91
|
+
module Internal_ # :nodoc:
|
92
|
+
module TestUnitVersion_ # :nodoc:
|
93
93
|
|
94
94
|
if TEST_UNIT_VERSION_ == :not_found
|
95
95
|
|
data/lib/xqsr3/io/writelines.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# Purpose: Adds a writelines() method to the IO module
|
6
6
|
#
|
7
7
|
# Created: 13th April 2007
|
8
|
-
# Updated:
|
8
|
+
# Updated: 12th April 2024
|
9
9
|
#
|
10
10
|
# Home: http://github.com/synesissoftware/xqsr3
|
11
11
|
#
|
@@ -68,7 +68,9 @@ module IO
|
|
68
68
|
# @!visibility private
|
69
69
|
def self.write_to_target_ target, contents, line_separator, column_separator, no_last_eol # :nodoc:
|
70
70
|
|
71
|
-
|
71
|
+
=begin
|
72
|
+
$stderr.puts "#{self.class}.write_to_target_(target(#{target.class})='#{target}', contents(#{contents.class})='#{contents}', line_separator(#{line_separator.class})='#{line_separator}', column_separator(#{column_separator.class})='#{column_separator}', no_last_eol(#{no_last_eol.class})=#{no_last_eol})" if $DEBUG
|
73
|
+
=end
|
72
74
|
|
73
75
|
if no_last_eol
|
74
76
|
|
data/lib/xqsr3/version.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# Purpose: Version for Xqsr3 library
|
6
6
|
#
|
7
7
|
# Created: 3rd April 2016
|
8
|
-
# Updated:
|
8
|
+
# Updated: 12th April 2024
|
9
9
|
#
|
10
10
|
# Home: http://github.com/synesissoftware/xqsr3
|
11
11
|
#
|
@@ -51,7 +51,7 @@
|
|
51
51
|
module Xqsr3
|
52
52
|
|
53
53
|
# Current version of the Xqsr3 library
|
54
|
-
VERSION = '0.39.
|
54
|
+
VERSION = '0.39.2'
|
55
55
|
|
56
56
|
private
|
57
57
|
VERSION_PARTS_ = VERSION.split(/[.]/).collect { |n| n.to_i } # :nodoc:
|
@@ -21,7 +21,7 @@ class Test_Xqsr3_Containers_FrequencyMap < Test::Unit::TestCase
|
|
21
21
|
|
22
22
|
assert_nil fm1.default
|
23
23
|
|
24
|
-
assert_match /^#<Xqsr3::Containers::FrequencyMap:0x\d+:\s*@count\(\w+\)=0; @elements\(Hash\)={}\s
|
24
|
+
assert_match (/^#<Xqsr3::Containers::FrequencyMap:0x\d+:\s*@count\(\w+\)=0; @elements\(Hash\)={}\s*>$/), fm1.inspect
|
25
25
|
end
|
26
26
|
|
27
27
|
def test_class_operator_subscript_2
|
@@ -32,7 +32,7 @@ class Test_Xqsr3_Containers_FrequencyMap < Test::Unit::TestCase
|
|
32
32
|
assert_not fm2.empty?
|
33
33
|
assert_equal 2, fm2.size
|
34
34
|
|
35
|
-
assert_match /^#<Xqsr3::Containers::FrequencyMap:0x\d+:\s*@count\(\w+\)=3; @elements\(Hash\)={.*abc.*def.*}\s
|
35
|
+
assert_match (/^#<Xqsr3::Containers::FrequencyMap:0x\d+:\s*@count\(\w+\)=3; @elements\(Hash\)={.*abc.*def.*}\s*>$/), fm2.inspect
|
36
36
|
end
|
37
37
|
|
38
38
|
def test_class_operator_subscript_3
|
@@ -16,15 +16,15 @@ class Test_IntegerParser < Test::Unit::TestCase
|
|
16
16
|
|
17
17
|
def test_show_base_being_ignored
|
18
18
|
|
19
|
-
assert_equal
|
20
|
-
assert_equal
|
21
|
-
assert_equal
|
22
|
-
assert_equal
|
23
|
-
|
24
|
-
assert_equal
|
25
|
-
assert_equal
|
26
|
-
assert_equal
|
27
|
-
assert_equal
|
19
|
+
assert_equal(-100, IP.to_integer(-100))
|
20
|
+
assert_equal(-100, IP.to_integer(-100, 0))
|
21
|
+
assert_equal(-100, IP.to_integer(-100.0, 0))
|
22
|
+
assert_equal(-100, IP.to_integer(-100.0, 10))
|
23
|
+
|
24
|
+
assert_equal(-100, IP.to_integer('-100'))
|
25
|
+
assert_equal(-100, IP.to_integer('-100', 0))
|
26
|
+
assert_equal(-100, IP.to_integer('-100', 10))
|
27
|
+
assert_equal(-4, IP.to_integer('-100', 2))
|
28
28
|
end
|
29
29
|
|
30
30
|
def test_default_for_invalid_type
|
@@ -34,15 +34,15 @@ class Test_IntegerParser < Test::Unit::TestCase
|
|
34
34
|
|
35
35
|
def test_to_integer_with_valid_values
|
36
36
|
|
37
|
-
assert_equal
|
38
|
-
assert_equal
|
39
|
-
assert_equal
|
40
|
-
assert_equal
|
37
|
+
assert_equal(0, IP.to_integer(0))
|
38
|
+
assert_equal(+1, IP.to_integer(1))
|
39
|
+
assert_equal(+1, IP.to_integer(+1))
|
40
|
+
assert_equal(-1, IP.to_integer(-1))
|
41
41
|
|
42
|
-
assert_equal
|
43
|
-
assert_equal
|
44
|
-
assert_equal
|
45
|
-
assert_equal
|
42
|
+
assert_equal(0, IP.to_integer('0'))
|
43
|
+
assert_equal(+1, IP.to_integer('1'))
|
44
|
+
assert_equal(+1, IP.to_integer('+1'))
|
45
|
+
assert_equal(-1, IP.to_integer('-1'))
|
46
46
|
end
|
47
47
|
|
48
48
|
def test_to_integer_with_invalid_values
|
@@ -138,7 +138,7 @@ class Test_WithCause < Test::Unit::TestCase
|
|
138
138
|
|
139
139
|
def initialize(*args, **options)
|
140
140
|
|
141
|
-
super
|
141
|
+
super(*args, **options)
|
142
142
|
end
|
143
143
|
|
144
144
|
include ::Xqsr3::Diagnostics::Exceptions::WithCause
|
@@ -150,7 +150,7 @@ class Test_WithCause < Test::Unit::TestCase
|
|
150
150
|
|
151
151
|
def initialize(*args, **options)
|
152
152
|
|
153
|
-
super
|
153
|
+
super(*args, **options)
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
@@ -226,7 +226,7 @@ class Test_WithCause_throwing < Test::Unit::TestCase
|
|
226
226
|
|
227
227
|
x_bt0 = x.backtrace[0]
|
228
228
|
|
229
|
-
assert /:in\s+\`f\'\s*$/ =~ x_bt0, 'not receieved from f()'
|
229
|
+
assert (/:in\s+\`f\'\s*$/ =~ x_bt0), 'not receieved from f()'
|
230
230
|
end
|
231
231
|
end
|
232
232
|
|
@@ -249,11 +249,11 @@ class Test_WithCause_throwing < Test::Unit::TestCase
|
|
249
249
|
|
250
250
|
x_bt0 = x.backtrace[0]
|
251
251
|
|
252
|
-
assert /:in\s+\`rescue in g\'\s*$/ =~ x_bt0, 'not receieved from g()'
|
252
|
+
assert (/:in\s+\`rescue in g\'\s*$/ =~ x_bt0), 'not receieved from g()'
|
253
253
|
|
254
254
|
c_bt0 = x.cause.backtrace[0]
|
255
255
|
|
256
|
-
assert /:in\s+\`f\'\s*$/ =~ c_bt0, 'not receieved from f()'
|
256
|
+
assert (/:in\s+\`f\'\s*$/ =~ c_bt0), 'not receieved from f()'
|
257
257
|
|
258
258
|
assert_not_empty x.chained_backtrace
|
259
259
|
end
|
@@ -19,7 +19,7 @@ class Test_Enumerable_detect_map < Test::Unit::TestCase
|
|
19
19
|
assert_not_nil [ 1, 2, 3, 4, 5 ].detect_map { |v| :nil }
|
20
20
|
|
21
21
|
assert_nil [].detect_map { |v| return -2 * v }
|
22
|
-
assert_equal
|
22
|
+
assert_equal(-2, [ 1, 2, 3, 4, 5 ].detect_map { |v| -2 * v })
|
23
23
|
assert_equal(-4, [ 1, 2, 3, 4, 5 ].detect_map { |v| -2 * v if 2 == v })
|
24
24
|
end
|
25
25
|
|
@@ -118,6 +118,78 @@ class Test_IO_writelines < Test::Unit::TestCase
|
|
118
118
|
assert_equal "abc\ndef", s.string
|
119
119
|
end
|
120
120
|
|
121
|
+
def test_two_strings_in_hash_with_col_sep
|
122
|
+
|
123
|
+
input = { 'ab' => 'c', 'de' => 'f' }
|
124
|
+
|
125
|
+
s = StringIO.new '', 'a'
|
126
|
+
|
127
|
+
r = ::IO.writelines s, input, column_separator: "\t"
|
128
|
+
|
129
|
+
assert_equal 2, r
|
130
|
+
assert_equal "ab\tc\nde\tf\n", s.string
|
131
|
+
end
|
132
|
+
|
133
|
+
def test_two_strings_in_hash_with_line_sep
|
134
|
+
|
135
|
+
input = { 'ab' => 'c', 'de' => 'f' }
|
136
|
+
|
137
|
+
s = StringIO.new '', 'a'
|
138
|
+
|
139
|
+
r = ::IO.writelines s, input, line_separator: '+'
|
140
|
+
|
141
|
+
assert_equal 2, r
|
142
|
+
assert_equal "abc+def+", s.string
|
143
|
+
end
|
144
|
+
|
145
|
+
def test_two_strings_in_hash_with_line_sep_and_col_sep
|
146
|
+
|
147
|
+
input = { 'ab' => 'c', 'de' => 'f' }
|
148
|
+
|
149
|
+
s = StringIO.new '', 'a'
|
150
|
+
|
151
|
+
r = ::IO.writelines s, input, line_separator: '+', column_separator: "\t"
|
152
|
+
|
153
|
+
assert_equal 2, r
|
154
|
+
assert_equal "ab\tc+de\tf+", s.string
|
155
|
+
end
|
156
|
+
|
157
|
+
def test_two_strings_in_hash_with_line_sep_and_col_sep_and_nolasteol
|
158
|
+
|
159
|
+
input = { 'ab' => 'c', 'de' => 'f' }
|
160
|
+
|
161
|
+
s = StringIO.new '', 'a'
|
162
|
+
|
163
|
+
r = ::IO.writelines s, input, line_separator: '+', column_separator: "\t", no_last_eol: true
|
164
|
+
|
165
|
+
assert_equal 2, r
|
166
|
+
assert_equal "ab\tc+de\tf", s.string
|
167
|
+
end
|
168
|
+
|
169
|
+
def test_two_strings_in_hash_with_arguments_of_line_sep
|
170
|
+
|
171
|
+
input = { 'ab' => 'c', 'de' => 'f' }
|
172
|
+
|
173
|
+
s = StringIO.new '', 'a'
|
174
|
+
|
175
|
+
r = ::IO.writelines s, input, '+'
|
176
|
+
|
177
|
+
assert_equal 2, r
|
178
|
+
assert_equal "abc+def+", s.string
|
179
|
+
end
|
180
|
+
|
181
|
+
def test_two_strings_in_hash_with_arguments_of_line_sep_and_col_sep
|
182
|
+
|
183
|
+
input = { 'ab' => 'c', 'de' => 'f' }
|
184
|
+
|
185
|
+
s = StringIO.new '', 'a'
|
186
|
+
|
187
|
+
r = ::IO.writelines s, input, '+', '-'
|
188
|
+
|
189
|
+
assert_equal 2, r
|
190
|
+
assert_equal "ab-c+de-f+", s.string
|
191
|
+
end
|
192
|
+
|
121
193
|
def test_ten_strings_in_array
|
122
194
|
|
123
195
|
input = (0...10).map { |i| i.to_s }
|
@@ -14,15 +14,15 @@ class Test_X_Kernel_Integer < Test::Unit::TestCase
|
|
14
14
|
|
15
15
|
def test_Integer_with_valid_values
|
16
16
|
|
17
|
-
assert_equal
|
18
|
-
assert_equal
|
19
|
-
assert_equal
|
20
|
-
assert_equal
|
21
|
-
|
22
|
-
assert_equal
|
23
|
-
assert_equal
|
24
|
-
assert_equal
|
25
|
-
assert_equal
|
17
|
+
assert_equal(0, Integer(0))
|
18
|
+
assert_equal(+1, Integer(1))
|
19
|
+
assert_equal(+1, Integer(+1))
|
20
|
+
assert_equal(-1, Integer(-1))
|
21
|
+
|
22
|
+
assert_equal(0, Integer('0'))
|
23
|
+
assert_equal(+1, Integer('1'))
|
24
|
+
assert_equal(+1, Integer('+1'))
|
25
|
+
assert_equal(-1, Integer('-1'))
|
26
26
|
end
|
27
27
|
|
28
28
|
def test_Integer_with_invalid_values
|
@@ -22,7 +22,7 @@ class Test_X_Object_inspect < Test::Unit::TestCase
|
|
22
22
|
|
23
23
|
def inspect
|
24
24
|
|
25
|
-
make_inspect
|
25
|
+
make_inspect(**@inspect_options)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -35,66 +35,66 @@ class Test_X_Object_inspect < Test::Unit::TestCase
|
|
35
35
|
|
36
36
|
ex = Example1.new
|
37
37
|
|
38
|
-
assert_match
|
38
|
+
assert_match(/\A#<Test_X_Object_inspect::Example1:0x\d+>\z/, ex.inspect)
|
39
39
|
|
40
40
|
ex2 = ExampleWithHiddenFields.new
|
41
41
|
|
42
|
-
assert_match
|
42
|
+
assert_match(/\A#<Test_X_Object_inspect::ExampleWithHiddenFields:0x\d+>\z/, ex2.inspect)
|
43
43
|
end
|
44
44
|
|
45
45
|
def test_no_class
|
46
46
|
|
47
47
|
ex = Example1.new(no_class: true)
|
48
48
|
|
49
|
-
assert_match
|
49
|
+
assert_match(/\A#<0x\d+>\z/, ex.inspect)
|
50
50
|
|
51
51
|
ex2 = ExampleWithHiddenFields.new(no_class: true)
|
52
52
|
|
53
|
-
assert_match
|
53
|
+
assert_match(/\A#<0x\d+>\z/, ex2.inspect)
|
54
54
|
end
|
55
55
|
|
56
56
|
def test_no_object_id
|
57
57
|
|
58
58
|
ex = Example1.new(no_object_id: true)
|
59
59
|
|
60
|
-
assert_match
|
60
|
+
assert_match(/\A#<Test_X_Object_inspect::Example1>\z/, ex.inspect)
|
61
61
|
|
62
62
|
ex2 = ExampleWithHiddenFields.new(no_object_id: true)
|
63
63
|
|
64
|
-
assert_match
|
64
|
+
assert_match(/\A#<Test_X_Object_inspect::ExampleWithHiddenFields>\z/, ex2.inspect)
|
65
65
|
end
|
66
66
|
|
67
67
|
def test_show_fields
|
68
68
|
|
69
69
|
ex = Example1.new(show_fields: true)
|
70
70
|
|
71
|
-
assert_match
|
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
73
|
ex2 = ExampleWithHiddenFields.new(show_fields: true)
|
74
74
|
|
75
|
-
assert_match
|
75
|
+
assert_match(/\A#<Test_X_Object_inspect::ExampleWithHiddenFields:0x\d+:\s*@alphabet\(String\)='abcdefghijklmnopqrstuvwxyz';\s*@inspect_options\(.+\)=[^;]+>\z/, ex2.inspect)
|
76
76
|
end
|
77
77
|
|
78
78
|
def test_show_fields_hidden
|
79
79
|
|
80
80
|
ex = Example1.new(show_fields: true, hidden_fields: [ 'inspect_options' ])
|
81
81
|
|
82
|
-
assert_match
|
82
|
+
assert_match(/\A#<Test_X_Object_inspect::Example1:0x\d+:\s*@alphabet\(String\)='abcdefghijklmnopqrstuvwxyz';\s*@letters.*>\z/, ex.inspect)
|
83
83
|
|
84
84
|
ex2 = ExampleWithHiddenFields.new(show_fields: true, hidden_fields: [ 'inspect_options' ])
|
85
85
|
|
86
|
-
assert_match
|
86
|
+
assert_match(/\A#<Test_X_Object_inspect::ExampleWithHiddenFields:0x\d+:\s*@alphabet\(String\)='abcdefghijklmnopqrstuvwxyz'>\z/, ex2.inspect)
|
87
87
|
end
|
88
88
|
|
89
89
|
def test_show_fields_truncated
|
90
90
|
|
91
91
|
ex = Example1.new(show_fields: true, truncate_width: 10)
|
92
92
|
|
93
|
-
assert_match
|
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
95
|
ex2 = ExampleWithHiddenFields.new(show_fields: true, truncate_width: 10)
|
96
96
|
|
97
|
-
assert_match
|
97
|
+
assert_match(/\A#<Test_X_Object_inspect::ExampleWithHiddenFields:0x\d+:\s*@alphabet\(String\)='abcdefg...';\s*@inspect_options.*>\z/, ex2.inspect)
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
@@ -83,6 +83,18 @@ class Test_Xqsr3_IO_writelines < Test::Unit::TestCase
|
|
83
83
|
assert_equal "abc\ndef\n", s.string
|
84
84
|
end
|
85
85
|
|
86
|
+
def test_two_strings_in_hash_nolasteol
|
87
|
+
|
88
|
+
input = { 'ab' => 'c', 'de' => 'f' }
|
89
|
+
|
90
|
+
s = StringIO.new '', 'a'
|
91
|
+
|
92
|
+
r = ::Xqsr3::IO.writelines s, input, no_last_eol: true
|
93
|
+
|
94
|
+
assert_equal 2, r
|
95
|
+
assert_equal "abc\ndef", s.string
|
96
|
+
end
|
97
|
+
|
86
98
|
def test_two_strings_in_hash_with_col_sep
|
87
99
|
|
88
100
|
input = { 'ab' => 'c', 'de' => 'f' }
|
@@ -95,6 +107,54 @@ class Test_Xqsr3_IO_writelines < Test::Unit::TestCase
|
|
95
107
|
assert_equal "ab\tc\nde\tf\n", s.string
|
96
108
|
end
|
97
109
|
|
110
|
+
def test_two_strings_in_hash_with_line_sep
|
111
|
+
|
112
|
+
input = { 'ab' => 'c', 'de' => 'f' }
|
113
|
+
|
114
|
+
s = StringIO.new '', 'a'
|
115
|
+
|
116
|
+
r = ::Xqsr3::IO.writelines s, input, line_separator: '+'
|
117
|
+
|
118
|
+
assert_equal 2, r
|
119
|
+
assert_equal "abc+def+", s.string
|
120
|
+
end
|
121
|
+
|
122
|
+
def test_two_strings_in_hash_with_line_sep_and_col_sep
|
123
|
+
|
124
|
+
input = { 'ab' => 'c', 'de' => 'f' }
|
125
|
+
|
126
|
+
s = StringIO.new '', 'a'
|
127
|
+
|
128
|
+
r = ::Xqsr3::IO.writelines s, input, line_separator: '+', column_separator: "\t"
|
129
|
+
|
130
|
+
assert_equal 2, r
|
131
|
+
assert_equal "ab\tc+de\tf+", s.string
|
132
|
+
end
|
133
|
+
|
134
|
+
def test_two_strings_in_hash_with_line_sep_and_col_sep_and_nolasteol
|
135
|
+
|
136
|
+
input = { 'ab' => 'c', 'de' => 'f' }
|
137
|
+
|
138
|
+
s = StringIO.new '', 'a'
|
139
|
+
|
140
|
+
r = ::Xqsr3::IO.writelines s, input, line_separator: '+', column_separator: "\t", no_last_eol: true
|
141
|
+
|
142
|
+
assert_equal 2, r
|
143
|
+
assert_equal "ab\tc+de\tf", s.string
|
144
|
+
end
|
145
|
+
|
146
|
+
def test_two_entries_in_hash_with_line_sep_and_col_sep
|
147
|
+
|
148
|
+
input = { 'ab' => 'c', 'de' => 'f' }
|
149
|
+
|
150
|
+
s = StringIO.new '', 'a'
|
151
|
+
|
152
|
+
r = ::Xqsr3::IO.writelines s, input, line_separator: '+', column_separator: '-'
|
153
|
+
|
154
|
+
assert_equal 2, r
|
155
|
+
assert_equal "ab-c+de-f+", s.string
|
156
|
+
end
|
157
|
+
|
98
158
|
def test_ten_strings_in_array
|
99
159
|
|
100
160
|
input = (0...10).map { |i| i.to_s }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xqsr3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.39.
|
4
|
+
version: 0.39.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Wilson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
14
|
eXtensions by fine Quantum for Standard Ruby and 3rd-party libraries is a
|