xqsr3 0.30.3 → 0.31.0
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 +5 -2
- data/lib/xqsr3/extensions/test/unit/assert_raise_with_message.rb +57 -41
- data/lib/xqsr3/internal_/test_unit_version_.rb +114 -0
- data/lib/xqsr3/version.rb +1 -1
- data/test/scratch/test_assert_raise_with_message.rb +31 -0
- data/test/unit/array_utilities/tc_join_with_or.rb +0 -0
- data/test/unit/extensions/enumerable/tc_detect_map.rb +0 -0
- data/test/unit/extensions/kernel/tc_integer.rb +0 -0
- data/test/unit/extensions/test/unit/tc_assert_raise_with_message.rb +5 -0
- data/test/unit/extensions/test/unit/tc_assert_subclass_of.rb +0 -0
- data/test/unit/extensions/test/unit/tc_assert_superclass_of.rb +0 -0
- data/test/unit/hash_utilities/tc_has_match.rb +0 -0
- data/test/unit/hash_utilities/tc_match.rb +0 -0
- metadata +5 -9
- data/lib/xqsr3/xml/utilities/compare.rb +0 -544
- data/lib/xqsr3/xml/utilities/navigation.rb +0 -108
- data/test/unit/xml/ts_all.rb +0 -12
- data/test/unit/xml/utilities/tc_compare.rb +0 -256
- data/test/unit/xml/utilities/tc_navigation.rb +0 -55
- data/test/unit/xml/utilities/ts_all.rb +0 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bb8664aa1ee309ca837b32e7aa3fbdca6dfaa1da
|
|
4
|
+
data.tar.gz: c180d98128e7c011ad1c58f5808413389eccfe10
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ba17becb2b869398fe39914bd7f0f3701fc3410612090690a3886486cfefaf015393712ec4421fab9e605e71b009348a67b24c62a92e14a141c4028dc384b0f6
|
|
7
|
+
data.tar.gz: 263f3ff72a18fdc7558c85ad52f4f07957c2d10b2d77bbec145c40235d20431ee9276a2f0a5c0cf98d17f77360b116b77e4871e74d871acdd0c8533b95f2bcb4
|
data/README.md
CHANGED
|
@@ -35,7 +35,9 @@ Install using `gem install xqsr3` or add it to your `Gemfile`.
|
|
|
35
35
|
* IO
|
|
36
36
|
* Quality
|
|
37
37
|
* String Utilities
|
|
38
|
-
* XML Utilities
|
|
38
|
+
* ~~XML Utilities~~ **NOTE**: The **XML** components formerly in **xqsr3** in
|
|
39
|
+
versions **0.29**-**0.30** are now contained in the separate project
|
|
40
|
+
[**xqsr3-xml**](https://github.com/synesissoftware.com/xqsr3-xml/).
|
|
39
41
|
|
|
40
42
|
and extensions to the following standard library components:
|
|
41
43
|
|
|
@@ -62,11 +64,12 @@ Defect reports, feature requests, and pull requests are welcome on https://githu
|
|
|
62
64
|
**xqsr3** is a runtime dependency in:
|
|
63
65
|
|
|
64
66
|
* the **[libCLImate.Ruby](https://github.com/synesissoftware/libCLImate.Ruby)** library;
|
|
67
|
+
* the [**xqsr3-xml**](https://github.com/synesissoftware.com/xqsr3-xml/) library.
|
|
65
68
|
|
|
66
69
|
and a development dependency in:
|
|
67
70
|
|
|
68
71
|
* the **[CLASP.Ruby](https://github.com/synesissoftware/CLASP.Ruby)** library;
|
|
69
|
-
* the **[Pantheios.Ruby](https://github.com/synesissoftware/Pantheios.Ruby)** library
|
|
72
|
+
* the **[Pantheios.Ruby](https://github.com/synesissoftware/Pantheios.Ruby)** library.
|
|
70
73
|
|
|
71
74
|
### License
|
|
72
75
|
|
|
@@ -1,79 +1,95 @@
|
|
|
1
1
|
|
|
2
|
+
require 'xqsr3/internal_/test_unit_version_'
|
|
3
|
+
|
|
4
|
+
module Xqsr3
|
|
5
|
+
module Internal_ # :nodoc:
|
|
6
|
+
module X_assert_raise_with_message_ # :nodoc:
|
|
7
|
+
|
|
8
|
+
if TestUnitVersion_.is_at_least? [ 3, 0, 8 ]
|
|
9
|
+
|
|
10
|
+
AssertionFailedError_ = Test::Unit::AssertionFailedError
|
|
11
|
+
else
|
|
12
|
+
|
|
13
|
+
class AssertionFailedError_ < ArgumentError; end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
end # module X_assert_raise_with_message_
|
|
17
|
+
end # module Internal_
|
|
18
|
+
end # module Xqsr3
|
|
19
|
+
|
|
2
20
|
module Test
|
|
3
21
|
module Unit
|
|
4
22
|
|
|
5
23
|
module Assertions
|
|
6
24
|
|
|
7
|
-
|
|
25
|
+
undef :assert_raise_with_message if respond_to? :assert_raise_with_message
|
|
8
26
|
|
|
9
|
-
|
|
27
|
+
def assert_raise_with_message(type_spec, message_spec, failure_message = nil, &block)
|
|
10
28
|
|
|
11
|
-
|
|
29
|
+
unless block_given?
|
|
12
30
|
|
|
13
|
-
|
|
31
|
+
msg = "WARNING: no block_given to assert_raise_with_message() called from: #{caller[0]}"
|
|
14
32
|
|
|
15
|
-
|
|
33
|
+
warn "\n#{msg}"
|
|
16
34
|
|
|
17
|
-
|
|
18
|
-
|
|
35
|
+
assert false, msg
|
|
36
|
+
end
|
|
19
37
|
|
|
20
|
-
|
|
21
|
-
|
|
38
|
+
case type_spec
|
|
39
|
+
when ::Array, nil
|
|
22
40
|
|
|
23
|
-
|
|
24
|
-
|
|
41
|
+
;
|
|
42
|
+
else
|
|
25
43
|
|
|
26
|
-
|
|
27
|
-
|
|
44
|
+
type_spec = [ type_spec ]
|
|
45
|
+
end
|
|
28
46
|
|
|
29
|
-
|
|
30
|
-
|
|
47
|
+
case message_spec
|
|
48
|
+
when ::Array, nil
|
|
31
49
|
|
|
32
|
-
|
|
33
|
-
|
|
50
|
+
;
|
|
51
|
+
else
|
|
34
52
|
|
|
35
|
-
|
|
36
|
-
|
|
53
|
+
message_spec = [ message_spec ]
|
|
54
|
+
end
|
|
37
55
|
|
|
38
56
|
|
|
39
|
-
|
|
57
|
+
begin
|
|
40
58
|
|
|
41
|
-
|
|
59
|
+
yield
|
|
42
60
|
|
|
43
|
-
|
|
44
|
-
|
|
61
|
+
assert false, 'the block did not throw an exception as was expected'
|
|
62
|
+
rescue ::Xqsr3::Internal_::X_assert_raise_with_message_::AssertionFailedError_
|
|
45
63
|
|
|
46
|
-
|
|
47
|
-
|
|
64
|
+
raise
|
|
65
|
+
rescue Exception => x
|
|
48
66
|
|
|
49
|
-
|
|
67
|
+
if type_spec
|
|
50
68
|
|
|
51
|
-
|
|
52
|
-
|
|
69
|
+
assert false, "exception (#{x.class}) - message: '#{x.message}' - not of any of required types (#{type_spec.join(', ')}); #{x.class} given" unless type_spec.any? { |c| x.is_a? c}
|
|
70
|
+
end
|
|
53
71
|
|
|
54
|
-
|
|
72
|
+
if message_spec
|
|
55
73
|
|
|
56
|
-
|
|
74
|
+
assert false, "exception message not of any of required messages; '#{x.message}' given" unless message_spec.any? do |m|
|
|
57
75
|
|
|
58
|
-
|
|
59
|
-
|
|
76
|
+
case m
|
|
77
|
+
when ::Regexp
|
|
60
78
|
|
|
61
|
-
|
|
62
|
-
|
|
79
|
+
x.message =~ m
|
|
80
|
+
when ::String
|
|
63
81
|
|
|
64
|
-
|
|
65
|
-
|
|
82
|
+
x.message == m
|
|
83
|
+
else
|
|
66
84
|
|
|
67
|
-
|
|
68
|
-
end
|
|
85
|
+
warn "\nunsupported message_spec entry '#{m}' (#{m.class})"
|
|
69
86
|
end
|
|
70
87
|
end
|
|
71
|
-
|
|
72
|
-
assert true
|
|
73
88
|
end
|
|
89
|
+
|
|
90
|
+
assert true
|
|
74
91
|
end
|
|
75
92
|
end
|
|
76
|
-
|
|
77
93
|
end # class Assertions
|
|
78
94
|
end # module Unit
|
|
79
95
|
end # module Test
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
|
|
2
|
+
# provides reliable mechanism for checking the version of the
|
|
3
|
+
# Test::Unit module
|
|
4
|
+
|
|
5
|
+
require 'test/unit'
|
|
6
|
+
begin
|
|
7
|
+
|
|
8
|
+
require 'test/unit/version'
|
|
9
|
+
|
|
10
|
+
module Xqsr3
|
|
11
|
+
module Internal_
|
|
12
|
+
module TestUnitVersion_
|
|
13
|
+
|
|
14
|
+
TEST_UNIT_VERSION_ = Test::Unit::VERSION # :nodoc:
|
|
15
|
+
end # module TestUnitVersion_
|
|
16
|
+
end # module Internal_
|
|
17
|
+
end # module Xqsr3
|
|
18
|
+
rescue LoadError
|
|
19
|
+
|
|
20
|
+
module Xqsr3
|
|
21
|
+
module Internal_
|
|
22
|
+
module TestUnitVersion_
|
|
23
|
+
|
|
24
|
+
TEST_UNIT_VERSION_ = :not_found # :nodoc:
|
|
25
|
+
end # module TestUnitVersion_
|
|
26
|
+
end # module Internal_
|
|
27
|
+
end # module Xqsr3
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
module Xqsr3
|
|
31
|
+
module Internal_ # :nodoc:
|
|
32
|
+
module TestUnitVersion_ # :nodoc:
|
|
33
|
+
|
|
34
|
+
if TEST_UNIT_VERSION_ == :not_found
|
|
35
|
+
|
|
36
|
+
TEST_UNIT_VERSION_PARTS_ = []
|
|
37
|
+
|
|
38
|
+
TEST_UNIT_VERSION_MAJOR_ = nil # :nodoc:
|
|
39
|
+
TEST_UNIT_VERSION_MINOR_ = nil # :nodoc:
|
|
40
|
+
TEST_UNIT_VERSION_PATCH_ = nil # :nodoc:
|
|
41
|
+
else
|
|
42
|
+
|
|
43
|
+
TEST_UNIT_VERSION_PARTS_ = TEST_UNIT_VERSION_.split(/[.]/).collect { |n| n.to_i } # :nodoc:
|
|
44
|
+
|
|
45
|
+
TEST_UNIT_VERSION_MAJOR_ = TEST_UNIT_VERSION_PARTS_[0] # :nodoc:
|
|
46
|
+
TEST_UNIT_VERSION_MINOR_ = TEST_UNIT_VERSION_PARTS_[1] # :nodoc:
|
|
47
|
+
TEST_UNIT_VERSION_PATCH_ = TEST_UNIT_VERSION_PARTS_[2] # :nodoc:
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def self.less_ a1, a2 # :nodoc:
|
|
51
|
+
|
|
52
|
+
n_common = a1.size < a2.size ? a1.size : a2.size
|
|
53
|
+
|
|
54
|
+
(0...n_common).each do |ix|
|
|
55
|
+
|
|
56
|
+
v1 = a1[ix]
|
|
57
|
+
v2 = a2[ix]
|
|
58
|
+
|
|
59
|
+
if v1 == v2
|
|
60
|
+
|
|
61
|
+
next
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
if v1 < v2
|
|
65
|
+
|
|
66
|
+
return true
|
|
67
|
+
else
|
|
68
|
+
|
|
69
|
+
return false
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
if n_common != a2.size
|
|
74
|
+
|
|
75
|
+
return true
|
|
76
|
+
else
|
|
77
|
+
|
|
78
|
+
return false
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def self.is_major_at_least? j # :nodoc:
|
|
83
|
+
|
|
84
|
+
return unless TEST_UNIT_VERSION_MAJOR_
|
|
85
|
+
|
|
86
|
+
return j >= TEST_UNIT_VERSION_MAJOR_
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def self.is_minor_at_least? n # :nodoc:
|
|
90
|
+
|
|
91
|
+
return unless TEST_UNIT_VERSION_MINOR_
|
|
92
|
+
|
|
93
|
+
return n >= TEST_UNIT_VERSION_MINOR_
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def self.is_at_least? v # :nodoc:
|
|
97
|
+
|
|
98
|
+
v = v.split(/\./).collect { |n| n.to_i } if String === v
|
|
99
|
+
|
|
100
|
+
return !less_(TEST_UNIT_VERSION_PARTS_, v)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def self.is_less? v # :nodoc:
|
|
104
|
+
|
|
105
|
+
v = v.split(/\./).collect { |n| n.to_i } if String === v
|
|
106
|
+
|
|
107
|
+
return less_(TEST_UNIT_VERSION_PARTS_, v)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
end # module TestUnitVersion_
|
|
111
|
+
end # module Internal_
|
|
112
|
+
end # module Xqsr3
|
|
113
|
+
|
|
114
|
+
|
data/lib/xqsr3/version.rb
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
$:.unshift File.join(File.dirname(__FILE__), '../../lib')
|
|
4
|
+
|
|
5
|
+
require 'xqsr3/extensions/test/unit/assert_raise_with_message'
|
|
6
|
+
|
|
7
|
+
require 'test/unit'
|
|
8
|
+
|
|
9
|
+
class Test_assert_raise_with_message < Test::Unit::TestCase
|
|
10
|
+
|
|
11
|
+
class UnusedException < RuntimeError; end
|
|
12
|
+
|
|
13
|
+
class TestException < RuntimeError; end
|
|
14
|
+
|
|
15
|
+
def test_1
|
|
16
|
+
|
|
17
|
+
assert_raise_with_message(UnusedException, "abc") { raise TestException, 'abc' }
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def test_2
|
|
21
|
+
|
|
22
|
+
assert_raise_with_message(TestException, "abcd") { raise TestException, 'abc' }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def test_3
|
|
26
|
+
|
|
27
|
+
assert_raise_with_message(TestException, /abc$/) { raise TestException, 'abcd' }
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -28,6 +28,11 @@ class Test_assert_raise_with_message < Test::Unit::TestCase
|
|
|
28
28
|
assert_raise_with_message([ ::ArgumentError, ::SystemExit ], nil) { raise ::ArgumentError, 'the-message' }
|
|
29
29
|
assert_raise_with_message([ ::SystemExit, ::ArgumentError ], nil) { raise ::ArgumentError, 'the-message' }
|
|
30
30
|
end
|
|
31
|
+
|
|
32
|
+
def test_class_and_regex_message
|
|
33
|
+
|
|
34
|
+
assert_raise_with_message(::RuntimeError, /the.*message/) { raise 'the-longer-message' }
|
|
35
|
+
end
|
|
31
36
|
end
|
|
32
37
|
|
|
33
38
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
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.
|
|
4
|
+
version: 0.31.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matt Wilson
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-02
|
|
11
|
+
date: 2019-03-02 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
|
|
@@ -67,6 +67,7 @@ files:
|
|
|
67
67
|
- lib/xqsr3/extensions/test/unit/assert_type_has_instance_methods.rb
|
|
68
68
|
- lib/xqsr3/hash_utilities/deep_transform.rb
|
|
69
69
|
- lib/xqsr3/hash_utilities/key_matching.rb
|
|
70
|
+
- lib/xqsr3/internal_/test_unit_version_.rb
|
|
70
71
|
- lib/xqsr3/io/writelines.rb
|
|
71
72
|
- lib/xqsr3/quality.rb
|
|
72
73
|
- lib/xqsr3/quality/parameter_checking.rb
|
|
@@ -78,9 +79,8 @@ files:
|
|
|
78
79
|
- lib/xqsr3/string_utilities/to_symbol.rb
|
|
79
80
|
- lib/xqsr3/string_utilities/truncate.rb
|
|
80
81
|
- lib/xqsr3/version.rb
|
|
81
|
-
- lib/xqsr3/xml/utilities/compare.rb
|
|
82
|
-
- lib/xqsr3/xml/utilities/navigation.rb
|
|
83
82
|
- test/performance/frequency_map.rb
|
|
83
|
+
- test/scratch/test_assert_raise_with_message.rb
|
|
84
84
|
- test/unit/array_utilities/tc_join_with_or.rb
|
|
85
85
|
- test/unit/array_utilities/ts_all.rb
|
|
86
86
|
- test/unit/command_line_utilities/tc_map_option_string.rb
|
|
@@ -135,10 +135,6 @@ files:
|
|
|
135
135
|
- test/unit/string_utilities/ts_all.rb
|
|
136
136
|
- test/unit/tc_version.rb
|
|
137
137
|
- test/unit/ts_all.rb
|
|
138
|
-
- test/unit/xml/ts_all.rb
|
|
139
|
-
- test/unit/xml/utilities/tc_compare.rb
|
|
140
|
-
- test/unit/xml/utilities/tc_navigation.rb
|
|
141
|
-
- test/unit/xml/utilities/ts_all.rb
|
|
142
138
|
homepage: http://github.com/synesissoftware/xqsr3
|
|
143
139
|
licenses:
|
|
144
140
|
- BSD-3-Clause
|
|
@@ -159,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
159
155
|
version: '0'
|
|
160
156
|
requirements: []
|
|
161
157
|
rubyforge_project:
|
|
162
|
-
rubygems_version: 2.
|
|
158
|
+
rubygems_version: 2.2.5
|
|
163
159
|
signing_key:
|
|
164
160
|
specification_version: 4
|
|
165
161
|
summary: xqsr3
|