test_tube 3.0.0 → 4.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 +4 -4
- data/README.md +4 -9
- data/lib/test_tube/invoker.rb +2 -2
- data/lib/test_tube/passer.rb +2 -2
- data/lib/test_tube.rb +14 -14
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a511d50711ff51b4ca13b4e6228f2e0d88dbfcb04b89ccb37619b1b2a3248073
|
4
|
+
data.tar.gz: 2eac86be8bdfc2733ed2fb11aa90bd4177c548e5319765549c04dd458dfd56e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80032c8cfacc36e4e49b48ba74dfbf0f0f82d8198fc2c40d66e42046d331312eb15a05bd11db0aa92fb748d3e9c6856731d3643bb543d0a90d4d725d43de9fd5
|
7
|
+
data.tar.gz: 4948793c91f4f2842af624a91d791875542c0eca3855780d266d88bc2c9153cb14fea30daf4e3f4afcd0671e439a80bb006ffba760b9669a93e4c577e8c9e345
|
data/README.md
CHANGED
@@ -43,7 +43,7 @@ the Universe, and Everything with the following matcher:
|
|
43
43
|
|
44
44
|
```ruby
|
45
45
|
class BeTheAnswer
|
46
|
-
def
|
46
|
+
def match?
|
47
47
|
42.equal?(yield)
|
48
48
|
end
|
49
49
|
end
|
@@ -78,7 +78,7 @@ experiment.got # => true
|
|
78
78
|
### __Matchi__ matchers
|
79
79
|
|
80
80
|
To facilitate the addition of matchers, a collection is available via the
|
81
|
-
[
|
81
|
+
[Matchi project](https://github.com/fixrb/matchi/).
|
82
82
|
|
83
83
|
Let's use a built-in __Matchi__ matcher:
|
84
84
|
|
@@ -146,11 +146,6 @@ __Test Tube__ follows [Semantic Versioning 2.0](https://semver.org/).
|
|
146
146
|
|
147
147
|
The [gem](https://rubygems.org/gems/test_tube) is available as open source under the terms of the [MIT License](https://github.com/fixrb/test_tube/raw/main/LICENSE.md).
|
148
148
|
|
149
|
-
|
149
|
+
## Sponsors
|
150
150
|
|
151
|
-
|
152
|
-
This project is sponsored by:<br />
|
153
|
-
<a href="https://sashite.com/"><img
|
154
|
-
src="https://github.com/fixrb/test_tube/raw/main/img/sashite.png"
|
155
|
-
alt="Sashité" /></a>
|
156
|
-
</p>
|
151
|
+
This project is sponsored by [Sashité](https://sashite.com/)
|
data/lib/test_tube/invoker.rb
CHANGED
@@ -13,13 +13,13 @@ module TestTube
|
|
13
13
|
|
14
14
|
# Class initializer.
|
15
15
|
#
|
16
|
-
# @param matcher [#
|
16
|
+
# @param matcher [#match?] A matcher.
|
17
17
|
# @param negate [Boolean] Invert the matcher or not.
|
18
18
|
# @param input [Proc] The callable object to test.
|
19
19
|
def initialize(matcher:, negate:, &input)
|
20
20
|
super()
|
21
21
|
|
22
|
-
@got = negate ^ matcher.
|
22
|
+
@got = negate ^ matcher.match? do
|
23
23
|
value = send_call.to(input)
|
24
24
|
@actual = value.object
|
25
25
|
value.call
|
data/lib/test_tube/passer.rb
CHANGED
@@ -10,13 +10,13 @@ module TestTube
|
|
10
10
|
# Class initializer.
|
11
11
|
#
|
12
12
|
# @param input [#object_id] The actual value to test.
|
13
|
-
# @param matcher [#
|
13
|
+
# @param matcher [#match?] A matcher.
|
14
14
|
# @param negate [Boolean] Invert the matcher or not.
|
15
15
|
def initialize(input, matcher:, negate:)
|
16
16
|
super()
|
17
17
|
|
18
18
|
@actual = input
|
19
|
-
@got = negate ^ matcher.
|
19
|
+
@got = negate ^ matcher.match? { input }
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
data/lib/test_tube.rb
CHANGED
@@ -7,15 +7,15 @@ require_relative File.join("test_tube", "passer")
|
|
7
7
|
#
|
8
8
|
# @api public
|
9
9
|
module TestTube
|
10
|
-
#
|
11
|
-
#
|
12
|
-
# @
|
10
|
+
# Invokes a block for testing.
|
11
|
+
#
|
12
|
+
# @see TestTube::Invoker#initialize for parameter details
|
13
13
|
#
|
14
14
|
# @example
|
15
15
|
# require "test_tube"
|
16
16
|
#
|
17
17
|
# class BeTheAnswer
|
18
|
-
# def
|
18
|
+
# def match?
|
19
19
|
# 42.equal?(yield)
|
20
20
|
# end
|
21
21
|
# end
|
@@ -24,20 +24,20 @@ module TestTube
|
|
24
24
|
# "101010".to_i(2)
|
25
25
|
# end
|
26
26
|
#
|
27
|
-
# @return [Invoker] A software experiment.
|
28
|
-
def self.invoke(
|
29
|
-
Invoker.new(
|
27
|
+
# @return [TestTube::Invoker] A software experiment.
|
28
|
+
def self.invoke(...)
|
29
|
+
Invoker.new(...)
|
30
30
|
end
|
31
31
|
|
32
|
-
#
|
33
|
-
#
|
34
|
-
# @
|
32
|
+
# Tests a value directly.
|
33
|
+
#
|
34
|
+
# @see TestTube::Passer#initialize for parameter details
|
35
35
|
#
|
36
36
|
# @example
|
37
37
|
# require "test_tube"
|
38
38
|
#
|
39
39
|
# class BeTheAnswer
|
40
|
-
# def
|
40
|
+
# def match?
|
41
41
|
# 42.equal?(yield)
|
42
42
|
# end
|
43
43
|
# end
|
@@ -47,8 +47,8 @@ module TestTube
|
|
47
47
|
# negate: false
|
48
48
|
# )
|
49
49
|
#
|
50
|
-
# @return [Passer] A software experiment.
|
51
|
-
def self.pass(
|
52
|
-
Passer.new(
|
50
|
+
# @return [TestTube::Passer] A software experiment.
|
51
|
+
def self.pass(...)
|
52
|
+
Passer.new(...)
|
53
53
|
end
|
54
54
|
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test_tube
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyril Kato
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date: 2024-
|
10
|
+
date: 2024-12-30 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: defi
|
@@ -41,7 +40,6 @@ licenses:
|
|
41
40
|
- MIT
|
42
41
|
metadata:
|
43
42
|
rubygems_mfa_required: 'true'
|
44
|
-
post_install_message:
|
45
43
|
rdoc_options: []
|
46
44
|
require_paths:
|
47
45
|
- lib
|
@@ -56,8 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
56
54
|
- !ruby/object:Gem::Version
|
57
55
|
version: '0'
|
58
56
|
requirements: []
|
59
|
-
rubygems_version: 3.
|
60
|
-
signing_key:
|
57
|
+
rubygems_version: 3.6.2
|
61
58
|
specification_version: 4
|
62
59
|
summary: "A test tube to conduct software experiments \U0001F9EA"
|
63
60
|
test_files: []
|