fear 1.0.0 → 1.1.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/.rubocop.yml +4 -60
- data/.travis.yml +8 -4
- data/CHANGELOG.md +7 -1
- data/Gemfile +5 -3
- data/Gemfile.lock +18 -20
- data/README.md +28 -14
- data/Rakefile +61 -60
- data/examples/pattern_extracting.rb +8 -6
- data/examples/pattern_matching_binary_tree_set.rb +4 -2
- data/examples/pattern_matching_number_in_words.rb +46 -42
- data/fear.gemspec +29 -27
- data/lib/fear.rb +44 -37
- data/lib/fear/await.rb +33 -0
- data/lib/fear/awaitable.rb +28 -0
- data/lib/fear/either.rb +2 -0
- data/lib/fear/either_api.rb +2 -0
- data/lib/fear/either_pattern_match.rb +2 -0
- data/lib/fear/empty_partial_function.rb +3 -1
- data/lib/fear/extractor.rb +30 -28
- data/lib/fear/extractor/anonymous_array_splat_matcher.rb +2 -0
- data/lib/fear/extractor/any_matcher.rb +2 -0
- data/lib/fear/extractor/array_head_matcher.rb +2 -0
- data/lib/fear/extractor/array_matcher.rb +2 -0
- data/lib/fear/extractor/array_splat_matcher.rb +2 -0
- data/lib/fear/extractor/empty_list_matcher.rb +2 -0
- data/lib/fear/extractor/extractor_matcher.rb +5 -3
- data/lib/fear/extractor/grammar.rb +5 -3
- data/lib/fear/extractor/identifier_matcher.rb +2 -0
- data/lib/fear/extractor/matcher.rb +5 -3
- data/lib/fear/extractor/matcher/and.rb +3 -1
- data/lib/fear/extractor/named_array_splat_matcher.rb +2 -0
- data/lib/fear/extractor/pattern.rb +7 -5
- data/lib/fear/extractor/typed_identifier_matcher.rb +2 -0
- data/lib/fear/extractor/value_matcher.rb +2 -0
- data/lib/fear/extractor_api.rb +2 -0
- data/lib/fear/failure.rb +2 -0
- data/lib/fear/failure_pattern_match.rb +2 -0
- data/lib/fear/for.rb +4 -2
- data/lib/fear/for_api.rb +3 -1
- data/lib/fear/future.rb +141 -64
- data/lib/fear/future_api.rb +2 -0
- data/lib/fear/left.rb +3 -1
- data/lib/fear/left_pattern_match.rb +2 -0
- data/lib/fear/none.rb +4 -2
- data/lib/fear/none_pattern_match.rb +2 -0
- data/lib/fear/option.rb +3 -1
- data/lib/fear/option_api.rb +2 -0
- data/lib/fear/option_pattern_match.rb +2 -0
- data/lib/fear/partial_function.rb +10 -8
- data/lib/fear/partial_function/and_then.rb +4 -2
- data/lib/fear/partial_function/any.rb +2 -0
- data/lib/fear/partial_function/combined.rb +3 -1
- data/lib/fear/partial_function/empty.rb +2 -0
- data/lib/fear/partial_function/guard.rb +7 -5
- data/lib/fear/partial_function/guard/and.rb +2 -0
- data/lib/fear/partial_function/guard/and3.rb +2 -0
- data/lib/fear/partial_function/guard/or.rb +2 -0
- data/lib/fear/partial_function/lifted.rb +2 -0
- data/lib/fear/partial_function/or_else.rb +3 -1
- data/lib/fear/partial_function_class.rb +3 -1
- data/lib/fear/pattern_match.rb +3 -1
- data/lib/fear/pattern_matching_api.rb +3 -1
- data/lib/fear/promise.rb +11 -3
- data/lib/fear/right.rb +3 -1
- data/lib/fear/right_biased.rb +4 -2
- data/lib/fear/right_pattern_match.rb +2 -0
- data/lib/fear/some.rb +2 -0
- data/lib/fear/some_pattern_match.rb +2 -0
- data/lib/fear/struct.rb +235 -0
- data/lib/fear/success.rb +2 -0
- data/lib/fear/success_pattern_match.rb +2 -0
- data/lib/fear/try.rb +2 -0
- data/lib/fear/try_api.rb +2 -0
- data/lib/fear/try_pattern_match.rb +2 -0
- data/lib/fear/unit.rb +6 -2
- data/lib/fear/utils.rb +4 -2
- data/lib/fear/version.rb +4 -1
- data/spec/fear/done_spec.rb +7 -5
- data/spec/fear/either/mixin_spec.rb +4 -2
- data/spec/fear/either_pattern_match_spec.rb +10 -8
- data/spec/fear/extractor/array_matcher_spec.rb +65 -63
- data/spec/fear/extractor/extractor_matcher_spec.rb +64 -62
- data/spec/fear/extractor/grammar_array_spec.rb +5 -3
- data/spec/fear/extractor/identified_matcher_spec.rb +18 -16
- data/spec/fear/extractor/identifier_matcher_spec.rb +26 -24
- data/spec/fear/extractor/pattern_spec.rb +17 -15
- data/spec/fear/extractor/typed_identifier_matcher_spec.rb +23 -21
- data/spec/fear/extractor/value_matcher_number_spec.rb +29 -27
- data/spec/fear/extractor/value_matcher_string_spec.rb +27 -25
- data/spec/fear/extractor/value_matcher_symbol_spec.rb +24 -22
- data/spec/fear/extractor_api_spec.rb +70 -68
- data/spec/fear/extractor_spec.rb +23 -21
- data/spec/fear/failure_spec.rb +59 -57
- data/spec/fear/for_spec.rb +19 -17
- data/spec/fear/future_spec.rb +456 -240
- data/spec/fear/guard_spec.rb +26 -24
- data/spec/fear/left_spec.rb +60 -58
- data/spec/fear/none_spec.rb +36 -34
- data/spec/fear/option/mixin_spec.rb +9 -7
- data/spec/fear/option_pattern_match_spec.rb +10 -8
- data/spec/fear/partial_function/empty_spec.rb +12 -10
- data/spec/fear/partial_function_and_then_spec.rb +39 -37
- data/spec/fear/partial_function_composition_spec.rb +46 -44
- data/spec/fear/partial_function_or_else_spec.rb +92 -90
- data/spec/fear/partial_function_spec.rb +46 -44
- data/spec/fear/pattern_match_spec.rb +31 -29
- data/spec/fear/promise_spec.rb +19 -17
- data/spec/fear/right_biased/left.rb +28 -26
- data/spec/fear/right_biased/right.rb +51 -49
- data/spec/fear/right_spec.rb +58 -56
- data/spec/fear/some_spec.rb +30 -28
- data/spec/fear/success_spec.rb +50 -48
- data/spec/fear/try/mixin_spec.rb +5 -3
- data/spec/fear/try_pattern_match_spec.rb +10 -8
- data/spec/fear/utils_spec.rb +16 -14
- data/spec/spec_helper.rb +7 -5
- data/spec/struct_spec.rb +226 -0
- metadata +18 -13
data/lib/fear/success.rb
CHANGED
data/lib/fear/try.rb
CHANGED
data/lib/fear/try_api.rb
CHANGED
data/lib/fear/unit.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fear
|
2
4
|
# Represents lack of value. It's typically returned when function completed without a value.
|
3
5
|
#
|
@@ -17,12 +19,14 @@ module Fear
|
|
17
19
|
Unit = Object.new.tap do |unit|
|
18
20
|
# @return [String]
|
19
21
|
def unit.to_s
|
20
|
-
|
22
|
+
"#<Fear::Unit>"
|
21
23
|
end
|
22
24
|
|
23
25
|
# @return [String]
|
24
26
|
def unit.inspect
|
25
|
-
|
27
|
+
"#<Fear::Unit>"
|
26
28
|
end
|
27
29
|
end.freeze
|
30
|
+
|
31
|
+
public_constant :Unit
|
28
32
|
end
|
data/lib/fear/utils.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fear
|
2
4
|
# @private
|
3
5
|
module Utils
|
@@ -20,13 +22,13 @@ module Fear
|
|
20
22
|
|
21
23
|
def assert_type!(value, *types)
|
22
24
|
if types.none? { |type| value.is_a?(type) }
|
23
|
-
raise TypeError, "expected `#{value.inspect}` to be of #{types.join(
|
25
|
+
raise TypeError, "expected `#{value.inspect}` to be of #{types.join(", ")} class"
|
24
26
|
end
|
25
27
|
end
|
26
28
|
|
27
29
|
def return_or_call_proc(value)
|
28
30
|
if value.respond_to?(:call)
|
29
|
-
value.
|
31
|
+
value.()
|
30
32
|
else
|
31
33
|
value
|
32
34
|
end
|
data/lib/fear/version.rb
CHANGED
data/spec/fear/done_spec.rb
CHANGED
@@ -1,17 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
RSpec.describe Fear::Unit do
|
2
|
-
describe
|
4
|
+
describe "#to_s" do
|
3
5
|
subject { described_class.to_s }
|
4
6
|
|
5
|
-
it { is_expected.to eq(
|
7
|
+
it { is_expected.to eq("#<Fear::Unit>") }
|
6
8
|
end
|
7
9
|
|
8
|
-
describe
|
10
|
+
describe "#inspect" do
|
9
11
|
subject { described_class.inspect }
|
10
12
|
|
11
|
-
it { is_expected.to eq(
|
13
|
+
it { is_expected.to eq("#<Fear::Unit>") }
|
12
14
|
end
|
13
15
|
|
14
|
-
describe
|
16
|
+
describe "#==" do
|
15
17
|
it { is_expected.to eq(described_class) }
|
16
18
|
end
|
17
19
|
end
|
@@ -1,13 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
RSpec.describe Fear::Either::Mixin do
|
2
4
|
include Fear::Either::Mixin
|
3
5
|
|
4
|
-
describe
|
6
|
+
describe "Left()" do
|
5
7
|
subject { Left(42) }
|
6
8
|
|
7
9
|
it { is_expected.to eq(Fear::Left.new(42)) }
|
8
10
|
end
|
9
11
|
|
10
|
-
describe
|
12
|
+
describe "Right()" do
|
11
13
|
subject { Right(42) }
|
12
14
|
|
13
15
|
it { is_expected.to eq(Fear::Right.new(42)) }
|
@@ -1,5 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
RSpec.describe Fear::EitherPatternMatch do
|
2
|
-
context
|
4
|
+
context "Right" do
|
3
5
|
let(:matcher) do
|
4
6
|
described_class.new do |m|
|
5
7
|
m.right(:even?.to_proc) { |x| "#{x} is even" }
|
@@ -8,15 +10,15 @@ RSpec.describe Fear::EitherPatternMatch do
|
|
8
10
|
end
|
9
11
|
|
10
12
|
it do
|
11
|
-
expect(matcher.
|
12
|
-
expect(matcher.
|
13
|
+
expect(matcher.(Fear.right(4))).to eq("4 is even")
|
14
|
+
expect(matcher.(Fear.right(3))).to eq("3 is odd")
|
13
15
|
expect do
|
14
|
-
matcher.
|
16
|
+
matcher.(Fear.left(44))
|
15
17
|
end.to raise_error(Fear::MatchError)
|
16
18
|
end
|
17
19
|
end
|
18
20
|
|
19
|
-
context
|
21
|
+
context "Left" do
|
20
22
|
let(:matcher) do
|
21
23
|
described_class.new do |m|
|
22
24
|
m.left(:even?.to_proc) { |x| "#{x} is even" }
|
@@ -25,10 +27,10 @@ RSpec.describe Fear::EitherPatternMatch do
|
|
25
27
|
end
|
26
28
|
|
27
29
|
it do
|
28
|
-
expect(matcher.
|
29
|
-
expect(matcher.
|
30
|
+
expect(matcher.(Fear.left(4))).to eq("4 is even")
|
31
|
+
expect(matcher.(Fear.left(3))).to eq("3 is odd")
|
30
32
|
expect do
|
31
|
-
matcher.
|
33
|
+
matcher.(Fear.right(44))
|
32
34
|
end.to raise_error(Fear::MatchError)
|
33
35
|
end
|
34
36
|
end
|
@@ -1,43 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
RSpec.describe Fear::Extractor::ArrayMatcher do
|
2
4
|
let(:parser) { Fear::Extractor::GrammarParser.new }
|
3
5
|
let(:matcher) { parser.parse(pattern).to_matcher }
|
4
6
|
|
5
|
-
describe
|
7
|
+
describe "#defined_at?" do
|
6
8
|
subject { matcher }
|
7
9
|
|
8
|
-
context
|
9
|
-
let(:pattern) {
|
10
|
+
context "empty array" do
|
11
|
+
let(:pattern) { "[]" }
|
10
12
|
|
11
13
|
it { is_expected.to be_defined_at([]) }
|
12
14
|
it { is_expected.not_to be_defined_at([1]) }
|
13
15
|
end
|
14
16
|
|
15
|
-
context
|
16
|
-
let(:pattern) {
|
17
|
+
context "empty array with splat" do
|
18
|
+
let(:pattern) { "[*]" }
|
17
19
|
|
18
20
|
it { is_expected.to be_defined_at([]) }
|
19
21
|
it { is_expected.to be_defined_at([1]) }
|
20
22
|
it { is_expected.to be_defined_at([1, 2]) }
|
21
23
|
end
|
22
24
|
|
23
|
-
context
|
24
|
-
let(:pattern) {
|
25
|
+
context "empty array with named splat" do
|
26
|
+
let(:pattern) { "[*var]" }
|
25
27
|
|
26
28
|
it { is_expected.to be_defined_at([]) }
|
27
29
|
it { is_expected.to be_defined_at([1]) }
|
28
30
|
it { is_expected.to be_defined_at([1, 2]) }
|
29
31
|
end
|
30
32
|
|
31
|
-
context
|
32
|
-
let(:pattern) {
|
33
|
+
context "one element array" do
|
34
|
+
let(:pattern) { "[1]" }
|
33
35
|
|
34
36
|
it { is_expected.not_to be_defined_at([]) }
|
35
37
|
it { is_expected.to be_defined_at([1]) }
|
36
38
|
it { is_expected.not_to be_defined_at([1, 2]) }
|
37
39
|
it { is_expected.not_to be_defined_at([2, 1]) }
|
38
40
|
|
39
|
-
context
|
40
|
-
let(:pattern) {
|
41
|
+
context "identifier" do
|
42
|
+
let(:pattern) { "[var]" }
|
41
43
|
|
42
44
|
it { is_expected.not_to be_defined_at([]) }
|
43
45
|
it { is_expected.to be_defined_at([1]) }
|
@@ -45,8 +47,8 @@ RSpec.describe Fear::Extractor::ArrayMatcher do
|
|
45
47
|
end
|
46
48
|
end
|
47
49
|
|
48
|
-
context
|
49
|
-
let(:pattern) {
|
50
|
+
context "two elements array with nested matcher" do
|
51
|
+
let(:pattern) { "[[1, *], 1]" }
|
50
52
|
|
51
53
|
it { is_expected.not_to be_defined_at([]) }
|
52
54
|
it { is_expected.to be_defined_at([[1], 1]) }
|
@@ -55,8 +57,8 @@ RSpec.describe Fear::Extractor::ArrayMatcher do
|
|
55
57
|
it { is_expected.not_to be_defined_at([2, 1]) }
|
56
58
|
end
|
57
59
|
|
58
|
-
context
|
59
|
-
let(:pattern) {
|
60
|
+
context "one element array with splat" do
|
61
|
+
let(:pattern) { "[1, *]" }
|
60
62
|
|
61
63
|
it { is_expected.not_to be_defined_at([]) }
|
62
64
|
it { is_expected.to be_defined_at([1]) }
|
@@ -65,8 +67,8 @@ RSpec.describe Fear::Extractor::ArrayMatcher do
|
|
65
67
|
it { is_expected.not_to be_defined_at([2, 1]) }
|
66
68
|
end
|
67
69
|
|
68
|
-
context
|
69
|
-
let(:pattern) {
|
70
|
+
context "one element array with named splat" do
|
71
|
+
let(:pattern) { "[1, *var]" }
|
70
72
|
|
71
73
|
it { is_expected.not_to be_defined_at([]) }
|
72
74
|
it { is_expected.to be_defined_at([1]) }
|
@@ -75,9 +77,9 @@ RSpec.describe Fear::Extractor::ArrayMatcher do
|
|
75
77
|
it { is_expected.not_to be_defined_at([2, 1]) }
|
76
78
|
end
|
77
79
|
|
78
|
-
context
|
79
|
-
context
|
80
|
-
let(:pattern) {
|
80
|
+
context "three elements array" do
|
81
|
+
context "with identifier in the middle" do
|
82
|
+
let(:pattern) { "[1, var, 2]" }
|
81
83
|
|
82
84
|
it { is_expected.not_to be_defined_at([]) }
|
83
85
|
it { is_expected.to be_defined_at([1, 3, 2]) }
|
@@ -87,16 +89,16 @@ RSpec.describe Fear::Extractor::ArrayMatcher do
|
|
87
89
|
it { is_expected.not_to be_defined_at([2]) }
|
88
90
|
end
|
89
91
|
|
90
|
-
context
|
91
|
-
let(:pattern) {
|
92
|
+
context "head and tail" do
|
93
|
+
let(:pattern) { "[head, *tail]" }
|
92
94
|
|
93
95
|
it { is_expected.not_to be_defined_at([]) }
|
94
96
|
it { is_expected.to be_defined_at([1, 3, 2]) }
|
95
97
|
end
|
96
98
|
end
|
97
99
|
|
98
|
-
context
|
99
|
-
let(:pattern) {
|
100
|
+
context "two element array" do
|
101
|
+
let(:pattern) { "[ 1, 2 ]" }
|
100
102
|
|
101
103
|
it { is_expected.not_to be_defined_at([]) }
|
102
104
|
it { is_expected.to be_defined_at([1, 2]) }
|
@@ -106,8 +108,8 @@ RSpec.describe Fear::Extractor::ArrayMatcher do
|
|
106
108
|
it { is_expected.not_to be_defined_at([2, 2]) }
|
107
109
|
it { is_expected.not_to be_defined_at([1, 2, 3]) }
|
108
110
|
|
109
|
-
context
|
110
|
-
let(:pattern) {
|
111
|
+
context "with identifier at the beginning" do
|
112
|
+
let(:pattern) { "[var, 2]" }
|
111
113
|
|
112
114
|
it { is_expected.not_to be_defined_at([]) }
|
113
115
|
it { is_expected.to be_defined_at([1, 2]) }
|
@@ -119,109 +121,109 @@ RSpec.describe Fear::Extractor::ArrayMatcher do
|
|
119
121
|
end
|
120
122
|
end
|
121
123
|
|
122
|
-
describe
|
123
|
-
subject { matcher.
|
124
|
+
describe "#call" do
|
125
|
+
subject { matcher.(other) }
|
124
126
|
|
125
|
-
context
|
127
|
+
context "on the same array" do
|
126
128
|
let(:other) { [1] }
|
127
|
-
let(:pattern) {
|
129
|
+
let(:pattern) { "[1]" }
|
128
130
|
|
129
131
|
it { is_expected.to eq({}) }
|
130
132
|
end
|
131
133
|
|
132
|
-
context
|
134
|
+
context "with splat on another array" do
|
133
135
|
let(:other) { [2, 1] }
|
134
|
-
let(:pattern) {
|
136
|
+
let(:pattern) { "[2, *]" }
|
135
137
|
|
136
138
|
it { is_expected.to eq({}) }
|
137
139
|
end
|
138
140
|
|
139
|
-
context
|
141
|
+
context "with identifier at the middle of an array" do
|
140
142
|
let(:other) { [2, 1, 3] }
|
141
|
-
let(:pattern) {
|
143
|
+
let(:pattern) { "[2, var, 3]" }
|
142
144
|
|
143
145
|
it { is_expected.to eq(var: 1) }
|
144
146
|
end
|
145
147
|
|
146
|
-
context
|
148
|
+
context "with identifier at the end of an array" do
|
147
149
|
let(:other) { [2, 1, 3] }
|
148
|
-
let(:pattern) {
|
150
|
+
let(:pattern) { "[2, 1, var]" }
|
149
151
|
|
150
152
|
it { is_expected.to eq(var: 3) }
|
151
153
|
end
|
152
154
|
|
153
|
-
context
|
155
|
+
context "with named splat matching all the array" do
|
154
156
|
let(:other) { [2, 1, 3, 4] }
|
155
|
-
let(:pattern) {
|
157
|
+
let(:pattern) { "[*var]" }
|
156
158
|
|
157
159
|
it { is_expected.to eq(var: [2, 1, 3, 4]) }
|
158
160
|
end
|
159
161
|
|
160
|
-
context
|
162
|
+
context "with named splat matching tail of an array" do
|
161
163
|
let(:other) { [2, 1, 3, 4] }
|
162
|
-
let(:pattern) {
|
164
|
+
let(:pattern) { "[2, 1, *var]" }
|
163
165
|
|
164
166
|
it { is_expected.to eq(var: [3, 4]) }
|
165
167
|
end
|
166
168
|
|
167
|
-
context
|
169
|
+
context "with named splat at the end of an array" do
|
168
170
|
let(:other) { [2, 1] }
|
169
|
-
let(:pattern) {
|
171
|
+
let(:pattern) { "[2, 1, *var]" }
|
170
172
|
|
171
173
|
it { is_expected.to eq(var: []) }
|
172
174
|
end
|
173
175
|
|
174
|
-
context
|
176
|
+
context "with several identifiers in an array" do
|
175
177
|
let(:other) { [2, 1, 3] }
|
176
|
-
let(:pattern) {
|
178
|
+
let(:pattern) { "[a, 1, b]" }
|
177
179
|
|
178
180
|
it { is_expected.to eq(a: 2, b: 3) }
|
179
181
|
end
|
180
182
|
|
181
|
-
context
|
183
|
+
context "head and tail" do
|
182
184
|
let(:other) { [2, 1, 3] }
|
183
|
-
let(:pattern) {
|
185
|
+
let(:pattern) { "[head, *tail]" }
|
184
186
|
|
185
187
|
it { is_expected.to eq(head: 2, tail: [1, 3]) }
|
186
188
|
end
|
187
189
|
|
188
|
-
context
|
190
|
+
context "ignore head, capture tail" do
|
189
191
|
let(:other) { [2, 1, 3] }
|
190
|
-
let(:pattern) {
|
192
|
+
let(:pattern) { "[_, *tail]" }
|
191
193
|
|
192
194
|
it { is_expected.to eq(tail: [1, 3]) }
|
193
195
|
end
|
194
196
|
end
|
195
197
|
|
196
|
-
describe
|
198
|
+
describe "#failure_reason" do
|
197
199
|
subject { matcher.failure_reason(other) }
|
198
200
|
|
199
|
-
context
|
201
|
+
context "on the same array" do
|
200
202
|
let(:other) { [1] }
|
201
|
-
let(:pattern) {
|
203
|
+
let(:pattern) { "[1]" }
|
202
204
|
|
203
205
|
it { is_expected.to eq(Fear.none) }
|
204
206
|
end
|
205
207
|
|
206
|
-
context
|
208
|
+
context "on another array" do
|
207
209
|
let(:other) { [2, 1] }
|
208
|
-
let(:pattern) {
|
210
|
+
let(:pattern) { "[2, 2]" }
|
209
211
|
|
210
|
-
it { is_expected.to eq(Fear.some(
|
211
|
-
Expected `1` to match:
|
212
|
-
[2, 2]
|
213
|
-
~~~~^
|
212
|
+
it { is_expected.to eq(Fear.some(<<~ERROR.strip)) }
|
213
|
+
Expected `1` to match:
|
214
|
+
[2, 2]
|
215
|
+
~~~~^
|
214
216
|
ERROR
|
215
217
|
end
|
216
218
|
|
217
|
-
context
|
219
|
+
context "element type mismatch" do
|
218
220
|
let(:other) { [2, 1] }
|
219
|
-
let(:pattern) {
|
221
|
+
let(:pattern) { "[[2], 1]" }
|
220
222
|
|
221
|
-
it { is_expected.to eq(Fear.some(
|
222
|
-
Expected `2` to match:
|
223
|
-
[[2], 1]
|
224
|
-
~~^
|
223
|
+
it { is_expected.to eq(Fear.some(<<~ERROR.strip)) }
|
224
|
+
Expected `2` to match:
|
225
|
+
[[2], 1]
|
226
|
+
~~^
|
225
227
|
ERROR
|
226
228
|
end
|
227
229
|
end
|