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,99 +1,101 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.describe Fear::PartialFunction::Guard do
2
- context 'Class' do
3
- context 'match' do
4
+ context "Class" do
5
+ context "match" do
4
6
  subject { Fear::PartialFunction::Guard.new(Integer) === 4 }
5
7
 
6
8
  it { is_expected.to eq(true) }
7
9
  end
8
10
 
9
- context 'not match' do
10
- subject { Fear::PartialFunction::Guard.new(Integer) === '4' }
11
+ context "not match" do
12
+ subject { Fear::PartialFunction::Guard.new(Integer) === "4" }
11
13
 
12
14
  it { is_expected.to eq(false) }
13
15
  end
14
16
  end
15
17
 
16
- context 'Symbol' do
17
- context 'match' do
18
+ context "Symbol" do
19
+ context "match" do
18
20
  subject { Fear::PartialFunction::Guard.new(:even?) === :even? }
19
21
 
20
22
  it { is_expected.to eq(true) }
21
23
  end
22
24
 
23
- context 'not match' do
25
+ context "not match" do
24
26
  subject { Fear::PartialFunction::Guard.new(:even?) === 4 }
25
27
 
26
28
  it { is_expected.to eq(false) }
27
29
  end
28
30
  end
29
31
 
30
- context 'Proc' do
31
- context 'match' do
32
+ context "Proc" do
33
+ context "match" do
32
34
  subject { Fear::PartialFunction::Guard.new(->(x) { x.even? }) === 4 }
33
35
 
34
36
  it { is_expected.to eq(true) }
35
37
  end
36
38
 
37
- context 'not match' do
39
+ context "not match" do
38
40
  subject { Fear::PartialFunction::Guard.new(->(x) { x.even? }) === 3 }
39
41
 
40
42
  it { is_expected.to eq(false) }
41
43
  end
42
44
  end
43
45
 
44
- describe '.and' do
45
- context 'match' do
46
+ describe ".and" do
47
+ context "match" do
46
48
  subject { guard === 4 }
47
49
  let(:guard) { Fear::PartialFunction::Guard.and([Integer, :even?.to_proc, ->(x) { x.even? }]) }
48
50
 
49
51
  it { is_expected.to eq(true) }
50
52
  end
51
53
 
52
- context 'not match' do
54
+ context "not match" do
53
55
  subject { guard === 3 }
54
56
  let(:guard) { Fear::PartialFunction::Guard.and([Integer, :even?.to_proc, ->(x) { x.even? }]) }
55
57
 
56
58
  it { is_expected.to eq(false) }
57
59
  end
58
60
 
59
- context 'empty array' do
61
+ context "empty array" do
60
62
  subject { guard === 4 }
61
63
  let(:guard) { Fear::PartialFunction::Guard.and([]) }
62
64
 
63
- it 'matches any values' do
65
+ it "matches any values" do
64
66
  is_expected.to eq(true)
65
67
  end
66
68
  end
67
69
 
68
- context 'short circuit' do
70
+ context "short circuit" do
69
71
  let(:guard) { Fear::PartialFunction::Guard.and([first, second, third]) }
70
72
  let(:first) { ->(_) { false } }
71
73
  let(:second) { ->(_) { raise } }
72
74
  let(:third) { ->(_) { raise } }
73
75
 
74
- it 'does not call the second and the third' do
76
+ it "does not call the second and the third" do
75
77
  expect { guard === 4 }.not_to raise_error
76
78
  end
77
79
  end
78
80
  end
79
81
 
80
- describe '.or' do
81
- let(:guard) { Fear::PartialFunction::Guard.or(['F', Integer]) }
82
+ describe ".or" do
83
+ let(:guard) { Fear::PartialFunction::Guard.or(["F", Integer]) }
82
84
 
83
- context 'match second' do
85
+ context "match second" do
84
86
  subject { guard === 4 }
85
87
 
86
88
  it { is_expected.to eq(true) }
87
89
  end
88
90
 
89
- context 'match first' do
90
- subject { guard === 'F' }
91
+ context "match first" do
92
+ subject { guard === "F" }
91
93
 
92
94
  it { is_expected.to eq(true) }
93
95
  end
94
96
 
95
- context 'not match' do
96
- subject { guard === 'A&' }
97
+ context "not match" do
98
+ subject { guard === "A&" }
97
99
 
98
100
  it { is_expected.to eq(false) }
99
101
  end
@@ -1,77 +1,79 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.describe Fear::Left do
2
4
  it_behaves_like Fear::RightBiased::Left do
3
- let(:left) { Fear.left('value') }
5
+ let(:left) { Fear.left("value") }
4
6
  end
5
7
 
6
- let(:left) { Fear.left('value') }
8
+ let(:left) { Fear.left("value") }
7
9
 
8
- describe '#right?' do
10
+ describe "#right?" do
9
11
  subject { left }
10
12
  it { is_expected.not_to be_right }
11
13
  end
12
14
 
13
- describe '#left?' do
15
+ describe "#left?" do
14
16
  subject { left }
15
17
  it { is_expected.to be_left }
16
18
  end
17
19
 
18
- describe '#select_or_else' do
20
+ describe "#select_or_else" do
19
21
  subject do
20
- left.select_or_else(default) { |v| v == 'value' }
22
+ left.select_or_else(default) { |v| v == "value" }
21
23
  end
22
24
 
23
- context 'proc default' do
25
+ context "proc default" do
24
26
  let(:default) { -> { -1 } }
25
27
 
26
- it 'returns itself' do
28
+ it "returns itself" do
27
29
  is_expected.to eq(left)
28
30
  end
29
31
  end
30
32
 
31
- context 'default' do
33
+ context "default" do
32
34
  let(:default) { -1 }
33
35
 
34
- it 'returns itself' do
36
+ it "returns itself" do
35
37
  is_expected.to eq(left)
36
38
  end
37
39
  end
38
40
  end
39
41
 
40
- describe '#or_else' do
42
+ describe "#or_else" do
41
43
  subject { left.or_else { alternative } }
42
44
  let(:alternative) { Fear.left(42) }
43
45
 
44
- it 'returns alternative' do
46
+ it "returns alternative" do
45
47
  is_expected.to eq(alternative)
46
48
  end
47
49
  end
48
50
 
49
- describe '#select' do
51
+ describe "#select" do
50
52
  subject do
51
- left.select { |v| v == 'value' }
53
+ left.select { |v| v == "value" }
52
54
  end
53
55
 
54
- it 'return self' do
56
+ it "return self" do
55
57
  is_expected.to eq(left)
56
58
  end
57
59
  end
58
60
 
59
- describe '#reject' do
61
+ describe "#reject" do
60
62
  subject do
61
- left.reject { |v| v == 'value' }
63
+ left.reject { |v| v == "value" }
62
64
  end
63
65
 
64
- it 'return self' do
66
+ it "return self" do
65
67
  is_expected.to eq(left)
66
68
  end
67
69
  end
68
70
 
69
- describe '#swap' do
71
+ describe "#swap" do
70
72
  subject { left.swap }
71
- it { is_expected.to eq(Fear.right('value')) }
73
+ it { is_expected.to eq(Fear.right("value")) }
72
74
  end
73
75
 
74
- describe '#reduce' do
76
+ describe "#reduce" do
75
77
  subject do
76
78
  left.reduce(
77
79
  ->(left) { "Left: #{left}" },
@@ -79,69 +81,69 @@ RSpec.describe Fear::Left do
79
81
  )
80
82
  end
81
83
 
82
- it { is_expected.to eq('Left: value') }
84
+ it { is_expected.to eq("Left: value") }
83
85
  end
84
86
 
85
- describe '#join_right' do
87
+ describe "#join_right" do
86
88
  subject(:join_right) { either.join_right }
87
89
 
88
- context 'value is Either' do
89
- let(:either) { described_class.new(Fear.left('error')) }
90
+ context "value is Either" do
91
+ let(:either) { described_class.new(Fear.left("error")) }
90
92
  it { is_expected.to eq(either) }
91
93
  end
92
94
 
93
- context 'value s not Either' do
94
- let(:either) { Fear.left('error') }
95
+ context "value s not Either" do
96
+ let(:either) { Fear.left("error") }
95
97
  it { is_expected.to eq(either) }
96
98
  end
97
99
  end
98
100
 
99
- describe '#join_left' do
100
- context 'value is Either' do
101
+ describe "#join_left" do
102
+ context "value is Either" do
101
103
  subject { either.join_left }
102
104
  let(:either) { described_class.new(value) }
103
- let(:value) { Fear.left('error') }
105
+ let(:value) { Fear.left("error") }
104
106
 
105
- it 'returns value' do
106
- is_expected.to eq(Fear.left('error'))
107
+ it "returns value" do
108
+ is_expected.to eq(Fear.left("error"))
107
109
  end
108
110
  end
109
111
 
110
- context 'value is not Either' do
112
+ context "value is not Either" do
111
113
  subject { proc { left.join_left } }
112
114
 
113
- it 'fails with type error' do
115
+ it "fails with type error" do
114
116
  is_expected.to raise_error(TypeError)
115
117
  end
116
118
  end
117
119
  end
118
120
 
119
- describe '#===' do
121
+ describe "#===" do
120
122
  subject { match === left }
121
123
 
122
- context 'matches erectly' do
123
- let(:match) { Fear.left('value') }
124
+ context "matches erectly" do
125
+ let(:match) { Fear.left("value") }
124
126
  it { is_expected.to eq(true) }
125
127
  end
126
128
 
127
- context 'value does not match' do
128
- let(:match) { Fear.left('error') }
129
+ context "value does not match" do
130
+ let(:match) { Fear.left("error") }
129
131
  it { is_expected.to eq(false) }
130
132
  end
131
133
 
132
- context 'matches by class' do
134
+ context "matches by class" do
133
135
  let(:match) { Fear.left(String) }
134
136
  it { is_expected.to eq(true) }
135
137
  end
136
138
 
137
- context 'does not matches by class' do
139
+ context "does not matches by class" do
138
140
  let(:match) { Fear.left(Integer) }
139
141
  it { is_expected.to eq(false) }
140
142
  end
141
143
  end
142
144
 
143
- describe '#match' do
144
- context 'matched' do
145
+ describe "#match" do
146
+ context "matched" do
145
147
  subject do
146
148
  left.match do |m|
147
149
  m.left(->(x) { x.length < 2 }) { |x| "Left: #{x}" }
@@ -150,15 +152,15 @@ RSpec.describe Fear::Left do
150
152
  end
151
153
  end
152
154
 
153
- it { is_expected.to eq('Left: value') }
155
+ it { is_expected.to eq("Left: value") }
154
156
  end
155
157
 
156
- context 'nothing matched and no else given' do
158
+ context "nothing matched and no else given" do
157
159
  subject do
158
160
  proc do
159
161
  left.match do |m|
160
162
  m.left(->(x) { x.length < 2 }) { |x| "Left: #{x}" }
161
- m.right { |_| 'noop' }
163
+ m.right { |_| "noop" }
162
164
  end
163
165
  end
164
166
  end
@@ -166,7 +168,7 @@ RSpec.describe Fear::Left do
166
168
  it { is_expected.to raise_error(Fear::MatchError) }
167
169
  end
168
170
 
169
- context 'nothing matched and else given' do
171
+ context "nothing matched and else given" do
170
172
  subject do
171
173
  left.match do |m|
172
174
  m.left(->(x) { x.length < 2 }) { |x| "Left: #{x}" }
@@ -178,31 +180,31 @@ RSpec.describe Fear::Left do
178
180
  end
179
181
  end
180
182
 
181
- describe '#to_s' do
183
+ describe "#to_s" do
182
184
  subject { left.to_s }
183
185
 
184
186
  it { is_expected.to eq('#<Fear::Left value="value">') }
185
187
  end
186
188
 
187
- describe 'pattern matching' do
188
- subject { Fear.xcase('Left(v : Integer)') { |v:| "matched #{v}" }.call_or_else(var) { 'nothing' } }
189
+ describe "pattern matching" do
190
+ subject { Fear.xcase("Left(v : Integer)") { |v:| "matched #{v}" }.call_or_else(var) { "nothing" } }
189
191
 
190
- context 'left of int' do
192
+ context "left of int" do
191
193
  let(:var) { Fear.left(42) }
192
194
 
193
- it { is_expected.to eq('matched 42') }
195
+ it { is_expected.to eq("matched 42") }
194
196
  end
195
197
 
196
- context 'left of string' do
197
- let(:var) { Fear.left('42') }
198
+ context "left of string" do
199
+ let(:var) { Fear.left("42") }
198
200
 
199
- it { is_expected.to eq('nothing') }
201
+ it { is_expected.to eq("nothing") }
200
202
  end
201
203
 
202
- context 'not left' do
203
- let(:var) { '42' }
204
+ context "not left" do
205
+ let(:var) { "42" }
204
206
 
205
- it { is_expected.to eq('nothing') }
207
+ it { is_expected.to eq("nothing") }
206
208
  end
207
209
  end
208
210
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.describe Fear::None do
2
4
  it_behaves_like Fear::RightBiased::Left do
3
5
  let(:left) { Fear.none }
@@ -5,105 +7,105 @@ RSpec.describe Fear::None do
5
7
 
6
8
  subject(:none) { Fear.none }
7
9
 
8
- describe '#get' do
10
+ describe "#get" do
9
11
  subject { proc { none.get } }
10
12
  it { is_expected.to raise_error(Fear::NoSuchElementError) }
11
13
  end
12
14
 
13
- describe '#or_nil' do
15
+ describe "#or_nil" do
14
16
  subject { none.or_nil }
15
17
  it { is_expected.to eq(nil) }
16
18
  end
17
19
 
18
- describe '#or_else' do
20
+ describe "#or_else" do
19
21
  subject { none.or_else { alternative } }
20
22
  let(:alternative) { Fear.some(42) }
21
23
 
22
- it 'returns alternative' do
24
+ it "returns alternative" do
23
25
  is_expected.to eq(alternative)
24
26
  end
25
27
  end
26
28
 
27
- describe '#empty?' do
29
+ describe "#empty?" do
28
30
  subject { none.empty? }
29
31
  it { is_expected.to eq(true) }
30
32
  end
31
33
 
32
- describe '#select' do
34
+ describe "#select" do
33
35
  subject { none.select { |value| value > 42 } }
34
36
 
35
- it 'always return None' do
37
+ it "always return None" do
36
38
  is_expected.to eq(Fear.none)
37
39
  end
38
40
  end
39
41
 
40
- describe '#reject' do
42
+ describe "#reject" do
41
43
  subject { none.reject { |value| value > 42 } }
42
44
 
43
- it 'always return None' do
45
+ it "always return None" do
44
46
  is_expected.to eq(Fear.none)
45
47
  end
46
48
  end
47
49
 
48
- describe '.new' do
50
+ describe ".new" do
49
51
  subject { Fear::None.class.new }
50
52
 
51
53
  it { is_expected.to eq(Fear::None) }
52
54
  end
53
55
 
54
- describe '.inherited' do
56
+ describe ".inherited" do
55
57
  subject { -> { Class.new(Fear.none.class) } }
56
58
 
57
- it 'raises error' do
58
- is_expected.to raise_error(RuntimeError, 'you are not allowed to inherit from NoneClass, use Fear::None instead')
59
+ it "raises error" do
60
+ is_expected.to raise_error(RuntimeError, "you are not allowed to inherit from NoneClass, use Fear::None instead")
59
61
  end
60
62
  end
61
63
 
62
- describe '#to_s' do
64
+ describe "#to_s" do
63
65
  subject { none.to_s }
64
66
 
65
- it { is_expected.to eq('#<Fear::NoneClass>') }
67
+ it { is_expected.to eq("#<Fear::NoneClass>") }
66
68
  end
67
69
 
68
- describe '#inspect' do
70
+ describe "#inspect" do
69
71
  subject { none.inspect }
70
72
 
71
- it { is_expected.to eq('#<Fear::NoneClass>') }
73
+ it { is_expected.to eq("#<Fear::NoneClass>") }
72
74
  end
73
75
 
74
- describe '#===' do
75
- context 'None' do
76
+ describe "#===" do
77
+ context "None" do
76
78
  subject { Fear::None === none }
77
79
 
78
80
  it { is_expected.to eq(true) }
79
81
  end
80
82
 
81
- context 'Fear::Some' do
83
+ context "Fear::Some" do
82
84
  subject { Fear::None === Fear.some(4) }
83
85
 
84
86
  it { is_expected.to eq(false) }
85
87
  end
86
88
 
87
- context 'Integer' do
89
+ context "Integer" do
88
90
  subject { Fear::None === 4 }
89
91
 
90
92
  it { is_expected.to eq(false) }
91
93
  end
92
94
  end
93
95
 
94
- describe '#match' do
95
- context 'matched' do
96
+ describe "#match" do
97
+ context "matched" do
96
98
  subject do
97
99
  none.match do |m|
98
100
  m.some { |x| x * 2 }
99
- m.none { 'noop' }
101
+ m.none { "noop" }
100
102
  end
101
103
  end
102
104
 
103
- it { is_expected.to eq('noop') }
105
+ it { is_expected.to eq("noop") }
104
106
  end
105
107
 
106
- context 'nothing matched and no else given' do
108
+ context "nothing matched and no else given" do
107
109
  subject do
108
110
  proc do
109
111
  none.match do |m|
@@ -115,7 +117,7 @@ RSpec.describe Fear::None do
115
117
  it { is_expected.to raise_error(Fear::MatchError) }
116
118
  end
117
119
 
118
- context 'nothing matched and else given' do
120
+ context "nothing matched and else given" do
119
121
  subject do
120
122
  none.match do |m|
121
123
  m.some { |x| x * 2 }
@@ -127,19 +129,19 @@ RSpec.describe Fear::None do
127
129
  end
128
130
  end
129
131
 
130
- describe 'pattern matching' do
131
- subject { Fear.xcase('None()') { 'matched' }.call_or_else(var) { 'nothing' } }
132
+ describe "pattern matching" do
133
+ subject { Fear.xcase("None()") { "matched" }.call_or_else(var) { "nothing" } }
132
134
 
133
- context 'none' do
135
+ context "none" do
134
136
  let(:var) { Fear.none }
135
137
 
136
- it { is_expected.to eq('matched') }
138
+ it { is_expected.to eq("matched") }
137
139
  end
138
140
 
139
- context 'not none' do
140
- let(:var) { '42' }
141
+ context "not none" do
142
+ let(:var) { "42" }
141
143
 
142
- it { is_expected.to eq('nothing') }
144
+ it { is_expected.to eq("nothing") }
143
145
  end
144
146
  end
145
147
  end