xqsr3 0.39.3.2 → 0.39.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/Rakefile +19 -0
- data/lib/xqsr3/internal_/test_ruby_version_.rb +132 -0
- data/lib/xqsr3/quality/parameter_checking.rb +7 -7
- data/lib/xqsr3/version.rb +1 -1
- data/test/unit/containers/tc_multi_map.rb +36 -4
- data/test/unit/diagnostics/exceptions/tc_with_cause.rb +21 -3
- metadata +24 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e63b8dde2a14ae264102be78c1da869c7f7dcc810633eb074077f21b7b54080
|
4
|
+
data.tar.gz: 7148e5f24c3d9583d67c4bd13561538e2b07bd785b4e7c8fcc365a4fac2b2d6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 954a1646bcc17c2a08ebfb420d480fa207aaa6c0f5da8fdad255d44b2e65cc953bc8ae9a8d269356e6cb1b586f3e9631b2602a8510baa40be40f96aa8ee9e52b
|
7
|
+
data.tar.gz: a06d5f01e2b87d3a0483958a26bbdbc45ad1a5df58a3b6381b914106e4f996cf12fe01bfaedc144689fdf69ae94ab251fb644e7287e9e290a2aba0b9a185521a
|
data/README.md
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
[](https://opensource.org/licenses/BSD-3-Clause)
|
5
5
|
[](https://badge.fury.io/rb/xqsr3)
|
6
6
|
[](https://github.com/synesissoftware/xqsr3/commits/master)
|
7
|
+
[](https://github.com/synesissoftware/xqsr3/actions/workflows/ruby.yml)
|
7
8
|
|
8
9
|
e**X**tensions by fine **Q**uantum for **S**tandard **R**uby and **3**rd-party libraries
|
9
10
|
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# Rakefile for xqsr3
|
2
|
+
|
3
|
+
require 'rake/testtask'
|
4
|
+
|
5
|
+
|
6
|
+
Rake::TestTask.new do |tt|
|
7
|
+
|
8
|
+
tt.libs << "lib"
|
9
|
+
tt.name = "test"
|
10
|
+
tt.test_files = FileList['test/**/tc_*.rb']
|
11
|
+
tt.verbose = true
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
task :default => :test
|
16
|
+
|
17
|
+
|
18
|
+
# ############################## end of file ############################# #
|
19
|
+
|
@@ -0,0 +1,132 @@
|
|
1
|
+
|
2
|
+
# ######################################################################## #
|
3
|
+
# File: lib/xqsr3/internal_/test_ruby_version_.rb
|
4
|
+
#
|
5
|
+
# Purpose: Provides reliable mechanism for checking the version of the
|
6
|
+
# Test::Unit module
|
7
|
+
#
|
8
|
+
# Created: 29th August 2025
|
9
|
+
# Updated: 29th August 2025
|
10
|
+
#
|
11
|
+
# Home: http://github.com/synesissoftware/xqsr3
|
12
|
+
#
|
13
|
+
# Author: Matthew Wilson
|
14
|
+
#
|
15
|
+
# Copyright (c) 2025, Matthew Wilson and Synesis Information Systems
|
16
|
+
# All rights reserved.
|
17
|
+
#
|
18
|
+
# Redistribution and use in source and binary forms, with or without
|
19
|
+
# modification, are permitted provided that the following conditions are
|
20
|
+
# met:
|
21
|
+
#
|
22
|
+
# * Redistributions of source code must retain the above copyright notice,
|
23
|
+
# this list of conditions and the following disclaimer.
|
24
|
+
#
|
25
|
+
# * Redistributions in binary form must reproduce the above copyright
|
26
|
+
# notice, this list of conditions and the following disclaimer in the
|
27
|
+
# documentation and/or other materials provided with the distribution.
|
28
|
+
#
|
29
|
+
# * Neither the name of the copyright holder nor the names of its
|
30
|
+
# contributors may be used to endorse or promote products derived from
|
31
|
+
# this software without specific prior written permission.
|
32
|
+
#
|
33
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
34
|
+
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
35
|
+
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
36
|
+
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
37
|
+
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
38
|
+
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
39
|
+
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
40
|
+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
41
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
42
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
43
|
+
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
44
|
+
#
|
45
|
+
# ######################################################################## #
|
46
|
+
|
47
|
+
|
48
|
+
# :stopdoc:
|
49
|
+
|
50
|
+
module Xqsr3
|
51
|
+
module Internal_ # :nodoc:
|
52
|
+
module TestRubyVersion_ # :nodoc:
|
53
|
+
|
54
|
+
RUBY_VERSION_PARTS_ = RUBY_VERSION.split(/[.]/).collect { |n| n.to_i } # :nodoc:
|
55
|
+
|
56
|
+
RUBY_VERSION_MAJOR_ = RUBY_VERSION_PARTS_[0] # :nodoc:
|
57
|
+
RUBY_VERSION_MINOR_ = RUBY_VERSION_PARTS_[1] # :nodoc:
|
58
|
+
RUBY_VERSION_PATCH_ = RUBY_VERSION_PARTS_[2] # :nodoc:
|
59
|
+
|
60
|
+
# @!visibility private
|
61
|
+
def self.less_ a1, a2 # :nodoc:
|
62
|
+
|
63
|
+
n_common = a1.size < a2.size ? a1.size : a2.size
|
64
|
+
|
65
|
+
(0...n_common).each do |ix|
|
66
|
+
|
67
|
+
v1 = a1[ix]
|
68
|
+
v2 = a2[ix]
|
69
|
+
|
70
|
+
if v1 == v2
|
71
|
+
|
72
|
+
next
|
73
|
+
end
|
74
|
+
|
75
|
+
if v1 < v2
|
76
|
+
|
77
|
+
return true
|
78
|
+
else
|
79
|
+
|
80
|
+
return false
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
if n_common != a2.size
|
85
|
+
|
86
|
+
return true
|
87
|
+
else
|
88
|
+
|
89
|
+
return false
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
# @!visibility private
|
94
|
+
def self.is_major_at_least? j # :nodoc:
|
95
|
+
|
96
|
+
return unless RUBY_VERSION_MAJOR_
|
97
|
+
|
98
|
+
return j >= RUBY_VERSION_MAJOR_
|
99
|
+
end
|
100
|
+
|
101
|
+
# @!visibility private
|
102
|
+
def self.is_minor_at_least? n # :nodoc:
|
103
|
+
|
104
|
+
return unless RUBY_VERSION_MINOR_
|
105
|
+
|
106
|
+
return n >= RUBY_VERSION_MINOR_
|
107
|
+
end
|
108
|
+
|
109
|
+
# @!visibility private
|
110
|
+
def self.is_at_least? v # :nodoc:
|
111
|
+
|
112
|
+
v = v.split(/\./).collect { |n| n.to_i } if String === v
|
113
|
+
|
114
|
+
return !less_(RUBY_VERSION_PARTS_, v)
|
115
|
+
end
|
116
|
+
|
117
|
+
# @!visibility private
|
118
|
+
def self.is_less? v # :nodoc:
|
119
|
+
|
120
|
+
v = v.split(/\./).collect { |n| n.to_i } if String === v
|
121
|
+
|
122
|
+
return less_(RUBY_VERSION_PARTS_, v)
|
123
|
+
end
|
124
|
+
|
125
|
+
end # module TestRubyVersion_
|
126
|
+
end # module Internal_
|
127
|
+
end # module Xqsr3
|
128
|
+
|
129
|
+
# :startdoc:
|
130
|
+
|
131
|
+
# ############################## end of file ############################# #
|
132
|
+
|
@@ -5,13 +5,13 @@
|
|
5
5
|
# Purpose: Definition of the ParameterChecking module
|
6
6
|
#
|
7
7
|
# Created: 12th February 2015
|
8
|
-
# Updated:
|
8
|
+
# Updated: 29th August 2025
|
9
9
|
#
|
10
10
|
# Home: http://github.com/synesissoftware/xqsr3
|
11
11
|
#
|
12
12
|
# Author: Matthew Wilson
|
13
13
|
#
|
14
|
-
# Copyright (c) 2019-
|
14
|
+
# Copyright (c) 2019-2025, Matthew Wilson and Synesis Information Systems
|
15
15
|
# Copyright (c) 2016-2019, Matthew Wilson and Synesis Software
|
16
16
|
# All rights reserved.
|
17
17
|
#
|
@@ -254,11 +254,11 @@ module Quality
|
|
254
254
|
|
255
255
|
unless unrecognised_option_names.empty?
|
256
256
|
|
257
|
-
|
257
|
+
warn_msg = "#{self}::check_parameter: the following options are not recognised:"
|
258
258
|
|
259
|
-
unrecognised_option_names.each { |n|
|
259
|
+
unrecognised_option_names.each { |n| warn_msg += "\n\t'#{n}'" }
|
260
260
|
|
261
|
-
warn
|
261
|
+
warn warn_msg
|
262
262
|
end
|
263
263
|
end
|
264
264
|
|
@@ -603,7 +603,7 @@ module Quality
|
|
603
603
|
value_uc = value.upcase
|
604
604
|
when :array_of_strings
|
605
605
|
|
606
|
-
value_uc = value.map
|
606
|
+
value_uc = value.map(&:upcase)
|
607
607
|
value_uc = value_uc.sort if io
|
608
608
|
end
|
609
609
|
end
|
@@ -622,7 +622,7 @@ module Quality
|
|
622
622
|
end
|
623
623
|
when :array_of_strings
|
624
624
|
|
625
|
-
v_uc = v.map
|
625
|
+
v_uc = v.map(&:upcase)
|
626
626
|
v_uc = v_uc.sort if io
|
627
627
|
|
628
628
|
if value_uc == v_uc
|
data/lib/xqsr3/version.rb
CHANGED
@@ -8,12 +8,16 @@ require 'xqsr3/containers/multi_map'
|
|
8
8
|
require 'xqsr3/extensions/test/unit'
|
9
9
|
require 'test/unit'
|
10
10
|
|
11
|
+
require 'xqsr3/internal_/test_ruby_version_'
|
12
|
+
|
11
13
|
|
12
14
|
include ::Xqsr3::Containers
|
13
15
|
|
14
16
|
|
15
17
|
class Test_Xqsr3_Containers_MultiMap < Test::Unit::TestCase
|
16
18
|
|
19
|
+
RUBY_IS_3_4_OR_LATER = Xqsr3::Internal_::TestRubyVersion_.is_at_least? [ 3, 4 ]
|
20
|
+
|
17
21
|
def test_class_operator_subscript_1
|
18
22
|
|
19
23
|
mm = MultiMap[]
|
@@ -908,21 +912,49 @@ class Test_Xqsr3_Containers_MultiMap < Test::Unit::TestCase
|
|
908
912
|
|
909
913
|
assert_equal "{}", mm.to_s
|
910
914
|
|
915
|
+
|
911
916
|
mm.store :abc
|
912
917
|
|
913
|
-
|
918
|
+
if RUBY_IS_3_4_OR_LATER
|
919
|
+
|
920
|
+
assert_equal "{abc: []}", mm.to_s
|
921
|
+
else
|
922
|
+
|
923
|
+
assert_equal "{:abc=>[]}", mm.to_s
|
924
|
+
end
|
925
|
+
|
914
926
|
|
915
927
|
mm.store :abc, 1
|
916
928
|
|
917
|
-
|
929
|
+
if RUBY_IS_3_4_OR_LATER
|
930
|
+
|
931
|
+
assert_equal "{abc: [1]}", mm.to_s
|
932
|
+
else
|
933
|
+
|
934
|
+
assert_equal "{:abc=>[1]}", mm.to_s
|
935
|
+
end
|
936
|
+
|
918
937
|
|
919
938
|
mm.store :abc, 1, 23
|
920
939
|
|
921
|
-
|
940
|
+
if RUBY_IS_3_4_OR_LATER
|
941
|
+
|
942
|
+
assert_equal "{abc: [1, 23]}", mm.to_s
|
943
|
+
else
|
944
|
+
|
945
|
+
assert_equal "{:abc=>[1, 23]}", mm.to_s
|
946
|
+
end
|
947
|
+
|
922
948
|
|
923
949
|
mm.store :def, *(0...10).to_a
|
924
950
|
|
925
|
-
|
951
|
+
if RUBY_IS_3_4_OR_LATER
|
952
|
+
|
953
|
+
assert_equal "{abc: [1, 23], def: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]}", mm.to_s
|
954
|
+
else
|
955
|
+
|
956
|
+
assert_equal "{:abc=>[1, 23], :def=>[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]}", mm.to_s
|
957
|
+
end
|
926
958
|
end
|
927
959
|
end
|
928
960
|
|
@@ -5,11 +5,17 @@ $:.unshift File.join(File.dirname(__FILE__), '../../../../lib')
|
|
5
5
|
|
6
6
|
require 'xqsr3/diagnostics/exceptions/with_cause'
|
7
7
|
|
8
|
+
require 'xqsr3/extensions/test/unit'
|
8
9
|
require 'test/unit'
|
9
10
|
|
11
|
+
require 'xqsr3/internal_/test_ruby_version_'
|
12
|
+
|
13
|
+
|
10
14
|
|
11
15
|
class Test_WithCause < Test::Unit::TestCase
|
12
16
|
|
17
|
+
RUBY_IS_3_4_OR_LATER = Xqsr3::Internal_::TestRubyVersion_.is_at_least? [ 3, 4 ]
|
18
|
+
|
13
19
|
class SomeExceptionWithCause < ::Exception
|
14
20
|
|
15
21
|
include ::Xqsr3::Diagnostics::Exceptions::WithCause
|
@@ -179,6 +185,8 @@ end
|
|
179
185
|
|
180
186
|
class Test_WithCause_throwing < Test::Unit::TestCase
|
181
187
|
|
188
|
+
RUBY_IS_3_4_OR_LATER = Xqsr3::Internal_::TestRubyVersion_.is_at_least? [ 3, 4 ]
|
189
|
+
|
182
190
|
class SomeExceptionWithCause < ::Exception
|
183
191
|
|
184
192
|
include ::Xqsr3::Diagnostics::Exceptions::WithCause
|
@@ -226,9 +234,12 @@ class Test_WithCause_throwing < Test::Unit::TestCase
|
|
226
234
|
assert_empty x.chainees
|
227
235
|
assert_not_empty x.backtrace
|
228
236
|
|
237
|
+
|
229
238
|
x_bt0 = x.backtrace[0]
|
230
239
|
|
231
|
-
|
240
|
+
re = RUBY_IS_3_4_OR_LATER ? /:\d+:in\s+'#{self.class.name}#f'\s*$/ : /:\d+:in\s+\`f'\s*$/
|
241
|
+
|
242
|
+
assert_match(re, x_bt0, "The received backtrace line '#{x_bt0}' in the exception received from `f()` did not match the expected pattern '#{re}'")
|
232
243
|
end
|
233
244
|
end
|
234
245
|
|
@@ -249,13 +260,20 @@ class Test_WithCause_throwing < Test::Unit::TestCase
|
|
249
260
|
assert_not_empty x.backtrace
|
250
261
|
assert_not_empty x.cause.backtrace
|
251
262
|
|
263
|
+
|
252
264
|
x_bt0 = x.backtrace[0]
|
253
265
|
|
254
|
-
|
266
|
+
re_x = RUBY_IS_3_4_OR_LATER ? /\d+:in\s+'#{self.class.name}#g'\s*$/ : /\d+:in\s+\`rescue in g'\s*$/
|
267
|
+
|
268
|
+
assert_match(re_x, x_bt0, "The received backtrace line '#{x_bt0}' in the exception received from `g()` did not match the expected pattern '#{re_x}'")
|
269
|
+
|
255
270
|
|
256
271
|
c_bt0 = x.cause.backtrace[0]
|
257
272
|
|
258
|
-
|
273
|
+
re_c = RUBY_IS_3_4_OR_LATER ? /:in\s+'#{self.class.name}#f'\s*$/ : /:\d+:in\s+\`f'\s*$/
|
274
|
+
|
275
|
+
assert_match(re_c, c_bt0, "The received backtrace line '#{x_bt0}' in the exception received from `f()` (via `g()`) did not match the expected pattern '#{re_c}'")
|
276
|
+
|
259
277
|
|
260
278
|
assert_not_empty x.chained_backtrace
|
261
279
|
end
|
metadata
CHANGED
@@ -1,19 +1,33 @@
|
|
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Wilson
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2025-08-29 00:00:00.000000000 Z
|
12
|
-
dependencies:
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2'
|
13
27
|
description: |
|
14
28
|
eXtensions by fine Quantum for Standard Ruby and 3rd-party libraries is a
|
15
|
-
lightweight, low-coupling library of assorted extensions to standard Ruby
|
16
|
-
3rd-party libraries.
|
29
|
+
lightweight, low-coupling library of assorted extensions to standard Ruby
|
30
|
+
and 3rd-party libraries.
|
17
31
|
email: matthew@synesis.com.au
|
18
32
|
executables: []
|
19
33
|
extensions: []
|
@@ -21,6 +35,7 @@ extra_rdoc_files: []
|
|
21
35
|
files:
|
22
36
|
- LICENSE
|
23
37
|
- README.md
|
38
|
+
- Rakefile
|
24
39
|
- examples/count_word_frequencies.md
|
25
40
|
- examples/count_word_frequencies.rb
|
26
41
|
- lib/xqsr3/all_extensions.rb
|
@@ -82,6 +97,7 @@ files:
|
|
82
97
|
- lib/xqsr3/hash_utilities.rb
|
83
98
|
- lib/xqsr3/hash_utilities/deep_transform.rb
|
84
99
|
- lib/xqsr3/hash_utilities/key_matching.rb
|
100
|
+
- lib/xqsr3/internal_/test_ruby_version_.rb
|
85
101
|
- lib/xqsr3/internal_/test_unit_version_.rb
|
86
102
|
- lib/xqsr3/io/writelines.rb
|
87
103
|
- lib/xqsr3/quality.rb
|
@@ -160,7 +176,7 @@ homepage: http://github.com/synesissoftware/xqsr3
|
|
160
176
|
licenses:
|
161
177
|
- BSD-3-Clause
|
162
178
|
metadata: {}
|
163
|
-
post_install_message:
|
179
|
+
post_install_message:
|
164
180
|
rdoc_options: []
|
165
181
|
require_paths:
|
166
182
|
- lib
|
@@ -178,8 +194,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
178
194
|
- !ruby/object:Gem::Version
|
179
195
|
version: '0'
|
180
196
|
requirements: []
|
181
|
-
rubygems_version: 3.
|
182
|
-
signing_key:
|
197
|
+
rubygems_version: 3.0.3.1
|
198
|
+
signing_key:
|
183
199
|
specification_version: 4
|
184
200
|
summary: xqsr3
|
185
201
|
test_files: []
|