xqsr3 0.20.3 → 0.21.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bde7d3536cc91501c44bf9692223a3ca08635a74
4
- data.tar.gz: 3cb71b348ae5a121dc557b2a99d23398f4066479
3
+ metadata.gz: c9936914cef9067c177b1b09269377d177462b12
4
+ data.tar.gz: 8b042c8bb542a09423bf91a4d63ba94fcd3d506b
5
5
  SHA512:
6
- metadata.gz: 7b8080d46eab81546cb68608e76562253a9b97c8009910cb69c2d6bdbf4ebeb9f205a745676146b69c7b6be9bae078cfeb390e5596299a452951aa42af2ee02d
7
- data.tar.gz: 7f76211a83a76ad171756da8ede38687348d5e478f809998a3917be4c03b6c239b6f55a4e6427a95b561ef71f131faff049a599e0bb3dda6970e655fa1b1a48e
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
+
@@ -50,7 +50,7 @@
50
50
  module Xqsr3
51
51
 
52
52
  # Current version of the Xqsr3 library
53
- VERSION = '0.20.3'
53
+ VERSION = '0.21.3'
54
54
 
55
55
  private
56
56
  VERSION_PARTS_ = VERSION.split(/[.]/).collect { |n| n.to_i } # :nodoc:
@@ -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.20.3
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/enumerable.rb
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/kernel.rb
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/string.rb
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.0.14.1
143
+ rubygems_version: 2.4.2
143
144
  signing_key:
144
145
  specification_version: 4
145
146
  summary: xqsr3