minitest-unordered 1.0.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 +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.autotest +26 -0
- data/.gemtest +0 -0
- data/History.txt +6 -0
- data/Manifest.txt +7 -0
- data/README.txt +89 -0
- data/Rakefile +13 -0
- data/lib/minitest/unordered.rb +52 -0
- data/test/test_minitest_unordered.rb +102 -0
- metadata +126 -0
- metadata.gz.sig +1 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e69f99656bc826abff3e92f0b7cd2a7074caf5f4
|
4
|
+
data.tar.gz: 7d79ee10d036d32b43e7c45b2ad7e91f4f0a54df
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c1b4ec816a5f16f42948c44ff50eb3effcf2a81914d5bbb61787cdda53f3216bdac742856671e092c0d8c56982e83862badb760d304573640687bdd147481ad4
|
7
|
+
data.tar.gz: 07b99601df8a08242054a8b167a3110c8dbf28635032e006d6f62dd377bc3cb7e11486b2f50a0352ebde444bfc38c3b52483edeb85c54edf046130f61056ffb8
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
Binary file
|
data/.autotest
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require "autotest/restart"
|
4
|
+
|
5
|
+
Autotest.add_hook :initialize do |at|
|
6
|
+
at.testlib = "minitest/autorun"
|
7
|
+
at.add_exception "tmp"
|
8
|
+
|
9
|
+
# at.extra_files << "../some/external/dependency.rb"
|
10
|
+
#
|
11
|
+
# at.libs << ":../some/external"
|
12
|
+
#
|
13
|
+
# at.add_exception "vendor"
|
14
|
+
#
|
15
|
+
# at.add_mapping(/dependency.rb/) do |f, _|
|
16
|
+
# at.files_matching(/test_.*rb$/)
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# %w(TestA TestB).each do |klass|
|
20
|
+
# at.extra_class_map[klass] = "test/test_misc.rb"
|
21
|
+
# end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Autotest.add_hook :run_command do |at|
|
25
|
+
# system "rake build"
|
26
|
+
# end
|
data/.gemtest
ADDED
File without changes
|
data/History.txt
ADDED
data/Manifest.txt
ADDED
data/README.txt
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
= minitest-unordered
|
2
|
+
|
3
|
+
home :: https://github.com/seattlerb/minitest-unordered
|
4
|
+
rdoc :: http://docs.seattlerb.org/minitest-unordered
|
5
|
+
|
6
|
+
== DESCRIPTION:
|
7
|
+
|
8
|
+
Adds a new assertion to minitest for checking the contents of a collection,
|
9
|
+
ignoring element order.
|
10
|
+
|
11
|
+
== FEATURES/PROBLEMS:
|
12
|
+
|
13
|
+
* The actual and expected collections must be Enumerable.
|
14
|
+
* Uses Hash#== for determining collection equivalence; as such, element
|
15
|
+
equality does not behave the same as with +assert_equal+.
|
16
|
+
|
17
|
+
== SYNOPSIS:
|
18
|
+
|
19
|
+
assert_equal_unordered %w[a a b c], %w[a b c a] # pass
|
20
|
+
assert_equal_unordered %w[a b b c], %w[a a b c] # fail
|
21
|
+
|
22
|
+
[1, 2, 3].must_equal_unordered [1, 2, 3] # pass
|
23
|
+
[1, 2, 3].must_equal_unordered [1, 2, 2] # fail
|
24
|
+
|
25
|
+
=== EXAMPLE:
|
26
|
+
|
27
|
+
require "minitest/autorun"
|
28
|
+
require "minitest/unordered"
|
29
|
+
|
30
|
+
class ExampleTest < MiniTest::Unit::TestCase
|
31
|
+
EXPECTED_DEPS = [
|
32
|
+
["hoe", "~> 2.13.1"],
|
33
|
+
["rdoc", "= 3.9"],
|
34
|
+
["rdoc", "= 3.8"],
|
35
|
+
["hoe", "~> 2.13.3"],
|
36
|
+
["hoe", "~> 2.13.2"],
|
37
|
+
["hoe", "~> 2.13.0"],
|
38
|
+
["rdoc", "= 3.12"]
|
39
|
+
]
|
40
|
+
|
41
|
+
def setup
|
42
|
+
@actual_deps = [
|
43
|
+
["rdoc", "= 3.9"],
|
44
|
+
["hoe", "~> 2.13.2"],
|
45
|
+
["hoe", "~> 2.13.3"],
|
46
|
+
["rdoc", "= 3.8"],
|
47
|
+
["hoe", "~> 2.13.1"],
|
48
|
+
["hoe", "~> 2.13.0"],
|
49
|
+
["rdoc", "= 3.12"]
|
50
|
+
]
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_expected_deps
|
54
|
+
assert_equal_unordered @actual_deps, EXPECTED_DEPS
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
== REQUIREMENTS:
|
59
|
+
|
60
|
+
* minitest
|
61
|
+
|
62
|
+
== INSTALL:
|
63
|
+
|
64
|
+
* sudo gem install minitest-unordered
|
65
|
+
|
66
|
+
== LICENSE:
|
67
|
+
|
68
|
+
(The MIT License)
|
69
|
+
|
70
|
+
Copyright (c) Ryan Davis, seattle.rb
|
71
|
+
|
72
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
73
|
+
a copy of this software and associated documentation files (the
|
74
|
+
'Software'), to deal in the Software without restriction, including
|
75
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
76
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
77
|
+
permit persons to whom the Software is furnished to do so, subject to
|
78
|
+
the following conditions:
|
79
|
+
|
80
|
+
The above copyright notice and this permission notice shall be
|
81
|
+
included in all copies or substantial portions of the Software.
|
82
|
+
|
83
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
84
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
85
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
86
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
87
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
88
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
89
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
require "minitest/unit"
|
2
|
+
require "minitest/spec"
|
3
|
+
|
4
|
+
module MiniTest::Unit::Unordered
|
5
|
+
VERSION = "1.0.0"
|
6
|
+
|
7
|
+
##
|
8
|
+
# Fails unless +a+ contains the same contents as +b+, regardless
|
9
|
+
# of order.
|
10
|
+
#
|
11
|
+
# assert_equal_unordered %w[a a b c], %w[a b c a] # pass
|
12
|
+
#
|
13
|
+
# NOTE: This uses Hash#== to determine collection equivalence, as
|
14
|
+
# such, do not expect it to behave the same as +assert_equal+.
|
15
|
+
#
|
16
|
+
# assert_equal [1], [1.0] # pass
|
17
|
+
# assert_equal({ 1 => true }, { 1.0 => true }) # fail
|
18
|
+
# assert_equal_unordered [1], [1.0] # fail
|
19
|
+
|
20
|
+
def assert_equal_unordered a, b, msg = nil
|
21
|
+
msg = message(msg) {
|
22
|
+
"Expected #{mu_pp a} to be equivalent to #{mu_pp b}"
|
23
|
+
}
|
24
|
+
|
25
|
+
assert_kind_of Enumerable, a
|
26
|
+
assert_kind_of Enumerable, b
|
27
|
+
|
28
|
+
c = Hash.new { |h,k| h[k] = 0 }; a.each do |e| c[e] += 1 end
|
29
|
+
d = Hash.new { |h,k| h[k] = 0 }; b.each do |e| d[e] += 1 end
|
30
|
+
|
31
|
+
assert c == d, msg
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class MiniTest::Unit::TestCase
|
36
|
+
include MiniTest::Unit::Unordered
|
37
|
+
end
|
38
|
+
|
39
|
+
module MiniTest::Spec::Unordered
|
40
|
+
##
|
41
|
+
# See MiniTest::Assertions#assert_equal_unordered
|
42
|
+
#
|
43
|
+
# collection.must_equal_unordered other
|
44
|
+
#
|
45
|
+
# :method: must_equal_unordered
|
46
|
+
|
47
|
+
infect_an_assertion :assert_equal_unordered, :must_equal_unordered, :reverse
|
48
|
+
end
|
49
|
+
|
50
|
+
class Object # :nodoc:
|
51
|
+
include MiniTest::Spec::Unordered
|
52
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
require "minitest/autorun"
|
2
|
+
require "minitest/unordered"
|
3
|
+
|
4
|
+
class TestMinitestUnordered < MiniTest::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
super
|
7
|
+
|
8
|
+
MiniTest::Unit::TestCase.reset
|
9
|
+
|
10
|
+
@tc = MiniTest::Unit::TestCase.new 'fake tc'
|
11
|
+
@assertion_count = 1
|
12
|
+
end
|
13
|
+
|
14
|
+
def teardown
|
15
|
+
assert_equal @assertion_count, @tc._assertions
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_assert_equal_unordered_when_comparable_elements
|
19
|
+
@assertion_count += 2
|
20
|
+
|
21
|
+
@tc.assert_equal_unordered [1, 2, 3], [2, 3, 1]
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_assert_equal_unordered_when_not_comparable_elements
|
25
|
+
@assertion_count += 2
|
26
|
+
|
27
|
+
@tc.assert_equal_unordered [true, false, true], [true, true, false]
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_assert_equal_unordered_when_enumerable_actual
|
31
|
+
@assertion_count += 2
|
32
|
+
|
33
|
+
es = Class.new do
|
34
|
+
include Enumerable
|
35
|
+
|
36
|
+
def initialize
|
37
|
+
@elems = [true, false, true]
|
38
|
+
end
|
39
|
+
|
40
|
+
def each
|
41
|
+
@elems.each { |e| yield e }
|
42
|
+
end
|
43
|
+
end.new
|
44
|
+
|
45
|
+
@tc.assert_equal_unordered es, [true, true, false]
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_assert_equal_unordered_triggered_more
|
49
|
+
@assertion_count += 3
|
50
|
+
|
51
|
+
e = @tc.assert_raises MiniTest::Assertion do
|
52
|
+
@tc.assert_equal_unordered [true, true], [true]
|
53
|
+
end
|
54
|
+
|
55
|
+
expected = "Expected [true, true] to be equivalent to [true]."
|
56
|
+
assert_equal expected, e.message
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_assert_equal_unordered_triggered_less
|
60
|
+
@assertion_count += 3
|
61
|
+
|
62
|
+
e = @tc.assert_raises MiniTest::Assertion do
|
63
|
+
@tc.assert_equal_unordered [true], [true, true]
|
64
|
+
end
|
65
|
+
|
66
|
+
expected = "Expected [true] to be equivalent to [true, true]."
|
67
|
+
assert_equal expected, e.message
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_assert_equal_unordered_triggered_different
|
71
|
+
@assertion_count += 3
|
72
|
+
|
73
|
+
e = @tc.assert_raises MiniTest::Assertion do
|
74
|
+
@tc.assert_equal_unordered [true, false, true], [false, false, true]
|
75
|
+
end
|
76
|
+
|
77
|
+
expected =
|
78
|
+
"Expected [true, false, true] to be equivalent to [false, false, true]."
|
79
|
+
assert_equal expected, e.message
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe MiniTest::Spec::Unordered do
|
84
|
+
it "needs to be sensible about must_equal_unordered order" do
|
85
|
+
[1, 2, 3].must_equal_unordered([1, 2, 3]).must_equal true
|
86
|
+
|
87
|
+
e = assert_raises MiniTest::Assertion do
|
88
|
+
[1, 2].must_equal_unordered [1, 2, 3]
|
89
|
+
end
|
90
|
+
|
91
|
+
assert_equal "Expected [1, 2] to be equivalent to [1, 2, 3].", e.message
|
92
|
+
|
93
|
+
e = assert_raises MiniTest::Assertion do
|
94
|
+
[1, 2].must_equal_unordered [1, 2, 3], "msg"
|
95
|
+
end
|
96
|
+
|
97
|
+
exp = "msg.\nExpected [1, 2] to be equivalent to [1, 2, 3]."
|
98
|
+
assert_equal exp, e.message
|
99
|
+
|
100
|
+
self._assertions.must_equal 14
|
101
|
+
end
|
102
|
+
end
|
metadata
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: minitest-unordered
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tuomas Kareinen
|
8
|
+
- Ryan Davis
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain:
|
12
|
+
- |
|
13
|
+
-----BEGIN CERTIFICATE-----
|
14
|
+
MIIDPjCCAiagAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
|
15
|
+
ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
|
16
|
+
GRYDY29tMB4XDTEzMDkxNjIzMDQxMloXDTE0MDkxNjIzMDQxMlowRTETMBEGA1UE
|
17
|
+
AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
|
18
|
+
JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
|
19
|
+
b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
|
20
|
+
taCPaLmfYIaFcHHCSY4hYDJijRQkLxPeB3xbOfzfLoBDbjvx5JxgJxUjmGa7xhcT
|
21
|
+
oOvjtt5P8+GSK9zLzxQP0gVLS/D0FmoE44XuDr3iQkVS2ujU5zZL84mMNqNB1znh
|
22
|
+
GiadM9GHRaDiaxuX0cIUBj19T01mVE2iymf9I6bEsiayK/n6QujtyCbTWsAS9Rqt
|
23
|
+
qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
|
24
|
+
gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
|
25
|
+
HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBBQUAA4IB
|
26
|
+
AQCFZ7JTzoy1gcG4d8A6dmOJy7ygtO5MFpRIz8HuKCF5566nOvpy7aHhDDzFmQuu
|
27
|
+
FX3zDU6ghx5cQIueDhf2SGOncyBmmJRRYawm3wI0o1MeN6LZJ/3cRaOTjSFy6+S6
|
28
|
+
zqDmHBp8fVA2TGJtO0BLNkbGVrBJjh0UPmSoGzWlRhEVnYC33TpDAbNA+u39UrQI
|
29
|
+
ynwhNN7YbnmSR7+JU2cUjBFv2iPBO+TGuWC+9L2zn3NHjuc6tnmSYipA9y8Hv+As
|
30
|
+
Y4evBVezr3SjXz08vPqRO5YRdO3zfeMT8gBjRqZjWJGMZ2lD4XNfrs7eky74CyZw
|
31
|
+
xx3n58i0lQkBE1EpKE0lFu/y
|
32
|
+
-----END CERTIFICATE-----
|
33
|
+
date: 2014-08-28 00:00:00.000000000 Z
|
34
|
+
dependencies:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: minitest
|
37
|
+
requirement: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ~>
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '5.4'
|
42
|
+
type: :development
|
43
|
+
prerelease: false
|
44
|
+
version_requirements: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ~>
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '5.4'
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: rdoc
|
51
|
+
requirement: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '4.0'
|
56
|
+
type: :development
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ~>
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '4.0'
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: hoe
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '3.12'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ~>
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '3.12'
|
77
|
+
description: |-
|
78
|
+
Adds a new assertion to minitest for checking the contents of a collection,
|
79
|
+
ignoring element order.
|
80
|
+
email:
|
81
|
+
- tkareine@gmail.com
|
82
|
+
- ryand-ruby@zenspider.com
|
83
|
+
executables: []
|
84
|
+
extensions: []
|
85
|
+
extra_rdoc_files:
|
86
|
+
- History.txt
|
87
|
+
- Manifest.txt
|
88
|
+
- README.txt
|
89
|
+
files:
|
90
|
+
- .autotest
|
91
|
+
- .gemtest
|
92
|
+
- History.txt
|
93
|
+
- Manifest.txt
|
94
|
+
- README.txt
|
95
|
+
- Rakefile
|
96
|
+
- lib/minitest/unordered.rb
|
97
|
+
- test/test_minitest_unordered.rb
|
98
|
+
homepage: https://github.com/seattlerb/minitest-unordered
|
99
|
+
licenses:
|
100
|
+
- MIT
|
101
|
+
metadata: {}
|
102
|
+
post_install_message:
|
103
|
+
rdoc_options:
|
104
|
+
- --main
|
105
|
+
- README.txt
|
106
|
+
require_paths:
|
107
|
+
- lib
|
108
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - '>='
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
requirements: []
|
119
|
+
rubyforge_project:
|
120
|
+
rubygems_version: 2.2.1
|
121
|
+
signing_key:
|
122
|
+
specification_version: 4
|
123
|
+
summary: Adds a new assertion to minitest for checking the contents of a collection,
|
124
|
+
ignoring element order.
|
125
|
+
test_files:
|
126
|
+
- test/test_minitest_unordered.rb
|
metadata.gz.sig
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
@{��d&�J�q��4=����a���Y�dЗ�����uH���+Bx+g9H@z��Kl�W�IL��T`XC!�1���4*Avr1Ô�t,�ߌn�Km`9ť�~�|���Ɍ@�G��.�EPӎ7L�_B9AkK���ޮ
|