xqsr3 0.20.3 → 0.21.3
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9936914cef9067c177b1b09269377d177462b12
|
4
|
+
data.tar.gz: 8b042c8bb542a09423bf91a4d63ba94fcd3d506b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74406b650004129620d0953bfa8831efd8a3c145b760494e8c6c07d1addfc8a3ca272d315726fe2dc183e66223044b2223b089e005a58adbc02e8d2275fe91ef
|
7
|
+
data.tar.gz: c17199c88637ef514364a4941963824fcceaaec2c00551a36fc852ff433ed8f192ed47a7c0206b3ae81bc39862f1596ed73cec0aa6409f2668fbf0c38aad76c5
|
@@ -7,4 +7,5 @@ require 'xqsr3/extensions/test/unit/assert_raise_with_message'
|
|
7
7
|
require 'xqsr3/extensions/test/unit/assert_subclass_of'
|
8
8
|
require 'xqsr3/extensions/test/unit/assert_superclass_of'
|
9
9
|
require 'xqsr3/extensions/test/unit/assert_true'
|
10
|
+
require 'xqsr3/extensions/test/unit/assert_type_has_instance_methods'
|
10
11
|
|
@@ -0,0 +1,74 @@
|
|
1
|
+
|
2
|
+
module Test
|
3
|
+
module Unit
|
4
|
+
|
5
|
+
module Assertions
|
6
|
+
|
7
|
+
unless respond_to? :assert_type_has_instance_methods
|
8
|
+
|
9
|
+
# Fails unless the given +type+ responds to all of the messages
|
10
|
+
# given by +message_spec+
|
11
|
+
#
|
12
|
+
# === Signature
|
13
|
+
#
|
14
|
+
# * *Parameters*
|
15
|
+
# - +type+:: [::Class] The type
|
16
|
+
# - +message_spec+:: [::Symbol, ::Array, ::Hash] A specification
|
17
|
+
# of message(s) received by the instances of +type+. If a
|
18
|
+
# ::Symbol, then instances must respond to this single message.
|
19
|
+
# If an ::Array (all elements of which must be ::Symbol), then
|
20
|
+
# instances must respond to _all_ messages. If a ::Hash, then
|
21
|
+
# instances must respond to _all_ messages represented by the
|
22
|
+
# keys; the values are available for specifying a custom failure
|
23
|
+
# message (or value is +nil+ for stock message)
|
24
|
+
# - +failure_message+:: [::String] If specified, is used when
|
25
|
+
# instances of +type+ do not respond to a message and no custom
|
26
|
+
# failure message is provided for it
|
27
|
+
def assert_type_has_instance_methods(type, message_spec, failure_message = nil)
|
28
|
+
|
29
|
+
warn "type parameter - '#{type} (#{type.class})' - should be a Class" unless type.is_a?(::Class)
|
30
|
+
|
31
|
+
case message_spec
|
32
|
+
when ::Hash
|
33
|
+
|
34
|
+
warn "every key in a Hash message_spec should be of type Symbol" unless message_spec.keys.all? { |k| ::Symbol === k }
|
35
|
+
when ::Array
|
36
|
+
|
37
|
+
warn "every key in an Array message_spec should be of type Symbol" unless message_spec.all? { |k| ::Symbol === k }
|
38
|
+
|
39
|
+
message_spec = Hash[message_spec.map { |s| [ s, nil ] }]
|
40
|
+
when ::Symbol
|
41
|
+
|
42
|
+
message_spec[message_spec] = nil
|
43
|
+
else
|
44
|
+
|
45
|
+
msg = "message_spec - '#{message_spec} (#{message_spec.class})' - should be a Symbol, an Array of Symbols, or a Hash of Symbol => message"
|
46
|
+
|
47
|
+
warn msg
|
48
|
+
|
49
|
+
return assert false, msg
|
50
|
+
end
|
51
|
+
|
52
|
+
ims = type.instance_methods
|
53
|
+
|
54
|
+
message_spec.each do |sym, msg|
|
55
|
+
|
56
|
+
unless ims.include? sym
|
57
|
+
|
58
|
+
msg ||= failure_message
|
59
|
+
msg ||= "type #{type} does not contain the instance method #{sym}"
|
60
|
+
|
61
|
+
return assert false, msg
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
assert true
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
end # class Assertions
|
70
|
+
end # module Unit
|
71
|
+
end # module Test
|
72
|
+
|
73
|
+
|
74
|
+
|
data/lib/xqsr3/version.rb
CHANGED
@@ -111,6 +111,34 @@ class Test_parameter_checks_as_included_module < Test::Unit::TestCase
|
|
111
111
|
assert_nil check_method_2('abc', [ ::Symbol, ::Regexp ], nothrow: true)
|
112
112
|
assert_nil check_method_2([ 'abc' ], [ [ ::Symbol ], ::Regexp ], nothrow: true)
|
113
113
|
assert_not_nil check_method_2([ 'abc' ], [ [ ::String ], ::Regexp ], nothrow: true)
|
114
|
+
assert_not_nil check_method_2(//, [ [ ::String ], ::Regexp ], nothrow: true)
|
115
|
+
assert_not_nil check_method_2([ [ 'abc', 'def' ], [ 'ghi', 'jkl' ] ], [ [ ::String ], ::Regexp, [ ::Array ] ], nothrow: true)
|
116
|
+
|
117
|
+
assert_not_nil check_method_2([ [ 'abc', 'def' ], [ 'ghi', 'jkl' ] ], [ [ ::String ], ::Regexp, [ ::Array ] ], nothrow: true) do |v|
|
118
|
+
|
119
|
+
if ::Array === v
|
120
|
+
|
121
|
+
na = v.count { |v2| ::Array === v2 }
|
122
|
+
|
123
|
+
0 == na || v.size == na
|
124
|
+
else
|
125
|
+
|
126
|
+
true
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
assert_nil check_method_2([ [ 'abc', 'def' ], nil, [ 'ghi', 'jkl' ] ], [ [ ::String ], ::Regexp, [ ::Array ] ], nothrow: true) do |v|
|
131
|
+
|
132
|
+
if ::Array === v
|
133
|
+
|
134
|
+
na = v.count { |v2| ::Array === v2 }
|
135
|
+
|
136
|
+
0 == na || v.size == na
|
137
|
+
else
|
138
|
+
|
139
|
+
true
|
140
|
+
end
|
141
|
+
end
|
114
142
|
end
|
115
143
|
|
116
144
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xqsr3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.21.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Wilson
|
@@ -19,6 +19,8 @@ executables: []
|
|
19
19
|
extensions: []
|
20
20
|
extra_rdoc_files: []
|
21
21
|
files:
|
22
|
+
- LICENSE
|
23
|
+
- README.md
|
22
24
|
- lib/xqsr3/array_utilities/join_with_or.rb
|
23
25
|
- lib/xqsr3/command_line_utilities/map_option_string.rb
|
24
26
|
- lib/xqsr3/containers/frequency_map.rb
|
@@ -28,26 +30,27 @@ files:
|
|
28
30
|
- lib/xqsr3/diagnostics/exceptions/with_cause.rb
|
29
31
|
- lib/xqsr3/doc_.rb
|
30
32
|
- lib/xqsr3/extensions/array/join_with_or.rb
|
33
|
+
- lib/xqsr3/extensions/enumerable.rb
|
31
34
|
- lib/xqsr3/extensions/enumerable/collect_with_index.rb
|
32
35
|
- lib/xqsr3/extensions/enumerable/detect_map.rb
|
33
36
|
- lib/xqsr3/extensions/enumerable/unique.rb
|
34
|
-
- lib/xqsr3/extensions/
|
37
|
+
- lib/xqsr3/extensions/hash.rb
|
35
38
|
- lib/xqsr3/extensions/hash/deep_transform.rb
|
36
39
|
- lib/xqsr3/extensions/hash/has_match.rb
|
37
40
|
- lib/xqsr3/extensions/hash/match.rb
|
38
|
-
- lib/xqsr3/extensions/hash.rb
|
39
|
-
- lib/xqsr3/extensions/io/writelines.rb
|
40
41
|
- lib/xqsr3/extensions/io.rb
|
42
|
+
- lib/xqsr3/extensions/io/writelines.rb
|
43
|
+
- lib/xqsr3/extensions/kernel.rb
|
41
44
|
- lib/xqsr3/extensions/kernel/integer.rb
|
42
45
|
- lib/xqsr3/extensions/kernel/raise_with_options.rb
|
43
|
-
- lib/xqsr3/extensions/
|
46
|
+
- lib/xqsr3/extensions/string.rb
|
44
47
|
- lib/xqsr3/extensions/string/ends_with.rb
|
45
48
|
- lib/xqsr3/extensions/string/map_option_string.rb
|
46
49
|
- lib/xqsr3/extensions/string/quote_if.rb
|
47
50
|
- lib/xqsr3/extensions/string/starts_with.rb
|
48
51
|
- lib/xqsr3/extensions/string/to_bool.rb
|
49
52
|
- lib/xqsr3/extensions/string/to_symbol.rb
|
50
|
-
- lib/xqsr3/extensions/
|
53
|
+
- lib/xqsr3/extensions/test/unit.rb
|
51
54
|
- lib/xqsr3/extensions/test/unit/assert_eql.rb
|
52
55
|
- lib/xqsr3/extensions/test/unit/assert_false.rb
|
53
56
|
- lib/xqsr3/extensions/test/unit/assert_not.rb
|
@@ -56,12 +59,12 @@ files:
|
|
56
59
|
- lib/xqsr3/extensions/test/unit/assert_subclass_of.rb
|
57
60
|
- lib/xqsr3/extensions/test/unit/assert_superclass_of.rb
|
58
61
|
- lib/xqsr3/extensions/test/unit/assert_true.rb
|
59
|
-
- lib/xqsr3/extensions/test/unit.rb
|
62
|
+
- lib/xqsr3/extensions/test/unit/assert_type_has_instance_methods.rb
|
60
63
|
- lib/xqsr3/hash_utilities/deep_transform.rb
|
61
64
|
- lib/xqsr3/hash_utilities/key_matching.rb
|
62
65
|
- lib/xqsr3/io/writelines.rb
|
63
|
-
- lib/xqsr3/quality/parameter_checking.rb
|
64
66
|
- lib/xqsr3/quality.rb
|
67
|
+
- lib/xqsr3/quality/parameter_checking.rb
|
65
68
|
- lib/xqsr3/string_utilities/ends_with.rb
|
66
69
|
- lib/xqsr3/string_utilities/quote_if.rb
|
67
70
|
- lib/xqsr3/string_utilities/starts_with.rb
|
@@ -117,8 +120,6 @@ files:
|
|
117
120
|
- test/unit/xml/ts_all.rb
|
118
121
|
- test/unit/xml/utilities/tc_compare.rb
|
119
122
|
- test/unit/xml/utilities/ts_all.rb
|
120
|
-
- README.md
|
121
|
-
- LICENSE
|
122
123
|
homepage: http://github.com/synesissoftware/xqsr3
|
123
124
|
licenses:
|
124
125
|
- 3-clause BSD
|
@@ -139,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
140
|
version: '0'
|
140
141
|
requirements: []
|
141
142
|
rubyforge_project:
|
142
|
-
rubygems_version: 2.
|
143
|
+
rubygems_version: 2.4.2
|
143
144
|
signing_key:
|
144
145
|
specification_version: 4
|
145
146
|
summary: xqsr3
|