fear 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +4 -60
  3. data/.travis.yml +8 -4
  4. data/CHANGELOG.md +7 -1
  5. data/Gemfile +5 -3
  6. data/Gemfile.lock +18 -20
  7. data/README.md +28 -14
  8. data/Rakefile +61 -60
  9. data/examples/pattern_extracting.rb +8 -6
  10. data/examples/pattern_matching_binary_tree_set.rb +4 -2
  11. data/examples/pattern_matching_number_in_words.rb +46 -42
  12. data/fear.gemspec +29 -27
  13. data/lib/fear.rb +44 -37
  14. data/lib/fear/await.rb +33 -0
  15. data/lib/fear/awaitable.rb +28 -0
  16. data/lib/fear/either.rb +2 -0
  17. data/lib/fear/either_api.rb +2 -0
  18. data/lib/fear/either_pattern_match.rb +2 -0
  19. data/lib/fear/empty_partial_function.rb +3 -1
  20. data/lib/fear/extractor.rb +30 -28
  21. data/lib/fear/extractor/anonymous_array_splat_matcher.rb +2 -0
  22. data/lib/fear/extractor/any_matcher.rb +2 -0
  23. data/lib/fear/extractor/array_head_matcher.rb +2 -0
  24. data/lib/fear/extractor/array_matcher.rb +2 -0
  25. data/lib/fear/extractor/array_splat_matcher.rb +2 -0
  26. data/lib/fear/extractor/empty_list_matcher.rb +2 -0
  27. data/lib/fear/extractor/extractor_matcher.rb +5 -3
  28. data/lib/fear/extractor/grammar.rb +5 -3
  29. data/lib/fear/extractor/identifier_matcher.rb +2 -0
  30. data/lib/fear/extractor/matcher.rb +5 -3
  31. data/lib/fear/extractor/matcher/and.rb +3 -1
  32. data/lib/fear/extractor/named_array_splat_matcher.rb +2 -0
  33. data/lib/fear/extractor/pattern.rb +7 -5
  34. data/lib/fear/extractor/typed_identifier_matcher.rb +2 -0
  35. data/lib/fear/extractor/value_matcher.rb +2 -0
  36. data/lib/fear/extractor_api.rb +2 -0
  37. data/lib/fear/failure.rb +2 -0
  38. data/lib/fear/failure_pattern_match.rb +2 -0
  39. data/lib/fear/for.rb +4 -2
  40. data/lib/fear/for_api.rb +3 -1
  41. data/lib/fear/future.rb +141 -64
  42. data/lib/fear/future_api.rb +2 -0
  43. data/lib/fear/left.rb +3 -1
  44. data/lib/fear/left_pattern_match.rb +2 -0
  45. data/lib/fear/none.rb +4 -2
  46. data/lib/fear/none_pattern_match.rb +2 -0
  47. data/lib/fear/option.rb +3 -1
  48. data/lib/fear/option_api.rb +2 -0
  49. data/lib/fear/option_pattern_match.rb +2 -0
  50. data/lib/fear/partial_function.rb +10 -8
  51. data/lib/fear/partial_function/and_then.rb +4 -2
  52. data/lib/fear/partial_function/any.rb +2 -0
  53. data/lib/fear/partial_function/combined.rb +3 -1
  54. data/lib/fear/partial_function/empty.rb +2 -0
  55. data/lib/fear/partial_function/guard.rb +7 -5
  56. data/lib/fear/partial_function/guard/and.rb +2 -0
  57. data/lib/fear/partial_function/guard/and3.rb +2 -0
  58. data/lib/fear/partial_function/guard/or.rb +2 -0
  59. data/lib/fear/partial_function/lifted.rb +2 -0
  60. data/lib/fear/partial_function/or_else.rb +3 -1
  61. data/lib/fear/partial_function_class.rb +3 -1
  62. data/lib/fear/pattern_match.rb +3 -1
  63. data/lib/fear/pattern_matching_api.rb +3 -1
  64. data/lib/fear/promise.rb +11 -3
  65. data/lib/fear/right.rb +3 -1
  66. data/lib/fear/right_biased.rb +4 -2
  67. data/lib/fear/right_pattern_match.rb +2 -0
  68. data/lib/fear/some.rb +2 -0
  69. data/lib/fear/some_pattern_match.rb +2 -0
  70. data/lib/fear/struct.rb +235 -0
  71. data/lib/fear/success.rb +2 -0
  72. data/lib/fear/success_pattern_match.rb +2 -0
  73. data/lib/fear/try.rb +2 -0
  74. data/lib/fear/try_api.rb +2 -0
  75. data/lib/fear/try_pattern_match.rb +2 -0
  76. data/lib/fear/unit.rb +6 -2
  77. data/lib/fear/utils.rb +4 -2
  78. data/lib/fear/version.rb +4 -1
  79. data/spec/fear/done_spec.rb +7 -5
  80. data/spec/fear/either/mixin_spec.rb +4 -2
  81. data/spec/fear/either_pattern_match_spec.rb +10 -8
  82. data/spec/fear/extractor/array_matcher_spec.rb +65 -63
  83. data/spec/fear/extractor/extractor_matcher_spec.rb +64 -62
  84. data/spec/fear/extractor/grammar_array_spec.rb +5 -3
  85. data/spec/fear/extractor/identified_matcher_spec.rb +18 -16
  86. data/spec/fear/extractor/identifier_matcher_spec.rb +26 -24
  87. data/spec/fear/extractor/pattern_spec.rb +17 -15
  88. data/spec/fear/extractor/typed_identifier_matcher_spec.rb +23 -21
  89. data/spec/fear/extractor/value_matcher_number_spec.rb +29 -27
  90. data/spec/fear/extractor/value_matcher_string_spec.rb +27 -25
  91. data/spec/fear/extractor/value_matcher_symbol_spec.rb +24 -22
  92. data/spec/fear/extractor_api_spec.rb +70 -68
  93. data/spec/fear/extractor_spec.rb +23 -21
  94. data/spec/fear/failure_spec.rb +59 -57
  95. data/spec/fear/for_spec.rb +19 -17
  96. data/spec/fear/future_spec.rb +456 -240
  97. data/spec/fear/guard_spec.rb +26 -24
  98. data/spec/fear/left_spec.rb +60 -58
  99. data/spec/fear/none_spec.rb +36 -34
  100. data/spec/fear/option/mixin_spec.rb +9 -7
  101. data/spec/fear/option_pattern_match_spec.rb +10 -8
  102. data/spec/fear/partial_function/empty_spec.rb +12 -10
  103. data/spec/fear/partial_function_and_then_spec.rb +39 -37
  104. data/spec/fear/partial_function_composition_spec.rb +46 -44
  105. data/spec/fear/partial_function_or_else_spec.rb +92 -90
  106. data/spec/fear/partial_function_spec.rb +46 -44
  107. data/spec/fear/pattern_match_spec.rb +31 -29
  108. data/spec/fear/promise_spec.rb +19 -17
  109. data/spec/fear/right_biased/left.rb +28 -26
  110. data/spec/fear/right_biased/right.rb +51 -49
  111. data/spec/fear/right_spec.rb +58 -56
  112. data/spec/fear/some_spec.rb +30 -28
  113. data/spec/fear/success_spec.rb +50 -48
  114. data/spec/fear/try/mixin_spec.rb +5 -3
  115. data/spec/fear/try_pattern_match_spec.rb +10 -8
  116. data/spec/fear/utils_spec.rb +16 -14
  117. data/spec/spec_helper.rb +7 -5
  118. data/spec/struct_spec.rb +226 -0
  119. metadata +18 -13
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Fear
2
4
  class Success
3
5
  include Try
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Fear
2
4
  # @api private
3
5
  class SuccessPatternMatch < Fear::TryPatternMatch
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Fear
2
4
  # The +Try+ represents a computation that may either result
3
5
  # in an exception, or return a successfully computed value. Instances of +Try+,
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Fear
2
4
  module TryApi
3
5
  # Constructs a +Try+ using the block. This
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Fear
2
4
  # Try pattern matcher
3
5
  #
@@ -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
- '#<Fear::Unit>'
22
+ "#<Fear::Unit>"
21
23
  end
22
24
 
23
25
  # @return [String]
24
26
  def unit.inspect
25
- '#<Fear::Unit>'
27
+ "#<Fear::Unit>"
26
28
  end
27
29
  end.freeze
30
+
31
+ public_constant :Unit
28
32
  end
@@ -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(', ')} class"
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.call
31
+ value.()
30
32
  else
31
33
  value
32
34
  end
@@ -1,3 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Fear
2
- VERSION = '1.0.0'.freeze
4
+ VERSION = "1.1.0"
5
+ public_constant :VERSION
3
6
  end
@@ -1,17 +1,19 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.describe Fear::Unit do
2
- describe '#to_s' do
4
+ describe "#to_s" do
3
5
  subject { described_class.to_s }
4
6
 
5
- it { is_expected.to eq('#<Fear::Unit>') }
7
+ it { is_expected.to eq("#<Fear::Unit>") }
6
8
  end
7
9
 
8
- describe '#inspect' do
10
+ describe "#inspect" do
9
11
  subject { described_class.inspect }
10
12
 
11
- it { is_expected.to eq('#<Fear::Unit>') }
13
+ it { is_expected.to eq("#<Fear::Unit>") }
12
14
  end
13
15
 
14
- describe '#==' do
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 'Left()' do
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 'Right()' do
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 'Right' do
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.call(Fear.right(4))).to eq('4 is even')
12
- expect(matcher.call(Fear.right(3))).to eq('3 is odd')
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.call(Fear.left(44))
16
+ matcher.(Fear.left(44))
15
17
  end.to raise_error(Fear::MatchError)
16
18
  end
17
19
  end
18
20
 
19
- context 'Left' do
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.call(Fear.left(4))).to eq('4 is even')
29
- expect(matcher.call(Fear.left(3))).to eq('3 is odd')
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.call(Fear.right(44))
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 '#defined_at?' do
7
+ describe "#defined_at?" do
6
8
  subject { matcher }
7
9
 
8
- context 'empty array' do
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 'empty array with splat' do
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 'empty array with named splat' do
24
- let(:pattern) { '[*var]' }
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 'one element array' do
32
- let(:pattern) { '[1]' }
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 'identifier' do
40
- let(:pattern) { '[var]' }
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 'two elements array with nested matcher' do
49
- let(:pattern) { '[[1, *], 1]' }
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 'one element array with splat' do
59
- let(:pattern) { '[1, *]' }
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 'one element array with named splat' do
69
- let(:pattern) { '[1, *var]' }
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 'three elements array' do
79
- context 'with identifier in the middle' do
80
- let(:pattern) { '[1, var, 2]' }
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 'head and tail' do
91
- let(:pattern) { '[head, *tail]' }
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 'two element array' do
99
- let(:pattern) { '[ 1, 2 ]' }
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 'with identifier at the beginning' do
110
- let(:pattern) { '[var, 2]' }
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 '#call' do
123
- subject { matcher.call(other) }
124
+ describe "#call" do
125
+ subject { matcher.(other) }
124
126
 
125
- context 'on the same array' do
127
+ context "on the same array" do
126
128
  let(:other) { [1] }
127
- let(:pattern) { '[1]' }
129
+ let(:pattern) { "[1]" }
128
130
 
129
131
  it { is_expected.to eq({}) }
130
132
  end
131
133
 
132
- context 'with splat on another array' do
134
+ context "with splat on another array" do
133
135
  let(:other) { [2, 1] }
134
- let(:pattern) { '[2, *]' }
136
+ let(:pattern) { "[2, *]" }
135
137
 
136
138
  it { is_expected.to eq({}) }
137
139
  end
138
140
 
139
- context 'with identifier at the middle of an array' do
141
+ context "with identifier at the middle of an array" do
140
142
  let(:other) { [2, 1, 3] }
141
- let(:pattern) { '[2, var, 3]' }
143
+ let(:pattern) { "[2, var, 3]" }
142
144
 
143
145
  it { is_expected.to eq(var: 1) }
144
146
  end
145
147
 
146
- context 'with identifier at the end of an array' do
148
+ context "with identifier at the end of an array" do
147
149
  let(:other) { [2, 1, 3] }
148
- let(:pattern) { '[2, 1, var]' }
150
+ let(:pattern) { "[2, 1, var]" }
149
151
 
150
152
  it { is_expected.to eq(var: 3) }
151
153
  end
152
154
 
153
- context 'with named splat matching all the array' do
155
+ context "with named splat matching all the array" do
154
156
  let(:other) { [2, 1, 3, 4] }
155
- let(:pattern) { '[*var]' }
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 'with named splat matching tail of an array' do
162
+ context "with named splat matching tail of an array" do
161
163
  let(:other) { [2, 1, 3, 4] }
162
- let(:pattern) { '[2, 1, *var]' }
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 'with named splat at the end of an array' do
169
+ context "with named splat at the end of an array" do
168
170
  let(:other) { [2, 1] }
169
- let(:pattern) { '[2, 1, *var]' }
171
+ let(:pattern) { "[2, 1, *var]" }
170
172
 
171
173
  it { is_expected.to eq(var: []) }
172
174
  end
173
175
 
174
- context 'with several identifiers in an array' do
176
+ context "with several identifiers in an array" do
175
177
  let(:other) { [2, 1, 3] }
176
- let(:pattern) { '[a, 1, b]' }
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 'head and tail' do
183
+ context "head and tail" do
182
184
  let(:other) { [2, 1, 3] }
183
- let(:pattern) { '[head, *tail]' }
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 'ignore head, capture tail' do
190
+ context "ignore head, capture tail" do
189
191
  let(:other) { [2, 1, 3] }
190
- let(:pattern) { '[_, *tail]' }
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 '#failure_reason' do
198
+ describe "#failure_reason" do
197
199
  subject { matcher.failure_reason(other) }
198
200
 
199
- context 'on the same array' do
201
+ context "on the same array" do
200
202
  let(:other) { [1] }
201
- let(:pattern) { '[1]' }
203
+ let(:pattern) { "[1]" }
202
204
 
203
205
  it { is_expected.to eq(Fear.none) }
204
206
  end
205
207
 
206
- context 'on another array' do
208
+ context "on another array" do
207
209
  let(:other) { [2, 1] }
208
- let(:pattern) { '[2, 2]' }
210
+ let(:pattern) { "[2, 2]" }
209
211
 
210
- it { is_expected.to eq(Fear.some(<<-ERROR.strip)) }
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 'element type mismatch' do
219
+ context "element type mismatch" do
218
220
  let(:other) { [2, 1] }
219
- let(:pattern) { '[[2], 1]' }
221
+ let(:pattern) { "[[2], 1]" }
220
222
 
221
- it { is_expected.to eq(Fear.some(<<-ERROR.strip)) }
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