skeem 0.0.23 → 0.0.24
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/CHANGELOG.md +11 -0
- data/README.md +11 -6
- data/lib/skeem/datum_dsl.rb +139 -0
- data/lib/skeem/element_visitor.rb +91 -0
- data/lib/skeem/grammar.rb +31 -8
- data/lib/skeem/interpreter.rb +1 -1
- data/lib/skeem/primitive/primitive_builder.rb +47 -37
- data/lib/skeem/runtime.rb +28 -4
- data/lib/skeem/s_expr_builder.rb +64 -25
- data/lib/skeem/s_expr_nodes.rb +81 -327
- data/lib/skeem/skm_compound_datum.rb +118 -0
- data/lib/skeem/skm_element.rb +85 -0
- data/lib/skeem/skm_expression.rb +7 -0
- data/lib/skeem/skm_simple_datum.rb +132 -0
- data/lib/skeem/skm_unary_expression.rb +107 -0
- data/lib/skeem/standard/base.skm +3 -3
- data/lib/skeem/tokenizer.rb +8 -1
- data/lib/skeem/version.rb +1 -1
- data/spec/skeem/datum_dsl_spec.rb +191 -0
- data/spec/skeem/element_visitor_spec.rb +170 -0
- data/spec/skeem/interpreter_spec.rb +126 -36
- data/spec/skeem/primitive/primitive_builder_spec.rb +48 -36
- data/spec/skeem/runtime_spec.rb +28 -2
- data/spec/skeem/s_expr_nodes_spec.rb +15 -277
- data/spec/skeem/skm_compound_datum_spec.rb +132 -0
- data/spec/skeem/skm_element_spec.rb +50 -0
- data/spec/skeem/skm_simple_datum_spec.rb +233 -0
- data/spec/skeem/skm_unary_expression_spec.rb +201 -0
- data/spec/skeem/tokenizer_spec.rb +7 -35
- metadata +21 -3
- data/lib/skeem/convertible.rb +0 -23
@@ -1,263 +1,12 @@
|
|
1
1
|
require 'ostruct'
|
2
2
|
require_relative '../spec_helper' # Use the RSpec framework
|
3
|
+
require_relative '../../lib/skeem/runtime'
|
3
4
|
require_relative '../../lib/skeem/s_expr_nodes' # Load the classes under test
|
4
5
|
|
5
6
|
module Skeem
|
6
|
-
describe SkmElement do
|
7
|
-
let(:pos) {double('fake-position') }
|
8
|
-
subject { SkmElement.new(pos) }
|
9
|
-
|
10
|
-
context 'Initialization:' do
|
11
|
-
it 'should be initialized with a position' do
|
12
|
-
expect { SkmElement.new(pos) }.not_to raise_error
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'should know its position' do
|
16
|
-
expect(subject.position).to eq(pos)
|
17
|
-
end
|
18
|
-
|
19
|
-
# Default (overridable) behavior of SkmElement
|
20
|
-
it 'should react by default to predicates' do
|
21
|
-
expect(subject).not_to be_boolean
|
22
|
-
expect(subject).not_to be_number
|
23
|
-
expect(subject).not_to be_real
|
24
|
-
expect(subject).not_to be_integer
|
25
|
-
expect(subject).not_to be_string
|
26
|
-
expect(subject).not_to be_symbol
|
27
|
-
end
|
28
|
-
end # context
|
29
|
-
end # describe
|
30
|
-
|
31
|
-
describe SkmTerminal do
|
32
|
-
let(:pos) { double('fake-position') }
|
33
|
-
let(:dummy_symbol) { double('fake-symbol') }
|
34
|
-
let(:sample_value) { 'sample-value' }
|
35
|
-
let(:dummy_token) do
|
36
|
-
obj = OpenStruct.new
|
37
|
-
obj.terminal = dummy_symbol
|
38
|
-
obj.lexeme = sample_value
|
39
|
-
obj
|
40
|
-
end
|
41
|
-
subject { SkmTerminal.new(dummy_token, pos) }
|
42
|
-
|
43
|
-
context 'Initialization:' do
|
44
|
-
it 'should be initialized with a token and a position' do
|
45
|
-
expect { SkmTerminal.new(dummy_token, pos) }.not_to raise_error
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'should know its token' do
|
49
|
-
expect(subject.token).to eq(dummy_token)
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'should know its value' do
|
53
|
-
expect(subject.value).to eq(sample_value)
|
54
|
-
end
|
55
|
-
|
56
|
-
it "should know the token's symbol" do
|
57
|
-
expect(subject.symbol).to eq(dummy_symbol)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
context 'Provided services:' do
|
62
|
-
it 'should return its text representation' do
|
63
|
-
expect(subject.inspect).to eq("<Skeem::SkmTerminal: sample-value>")
|
64
|
-
end
|
65
|
-
end # context
|
66
|
-
end # describe
|
67
|
-
|
68
|
-
describe SkmBoolean do
|
69
|
-
let(:pos) { double('fake-position') }
|
70
|
-
let(:dummy_symbol) { double('BOOLEAN') }
|
71
|
-
let(:sample_value) { false }
|
72
|
-
let(:dummy_token) do
|
73
|
-
obj = OpenStruct.new
|
74
|
-
obj.terminal = dummy_symbol
|
75
|
-
obj.lexeme = sample_value
|
76
|
-
obj
|
77
|
-
end
|
78
|
-
subject { SkmBoolean.new(dummy_token, pos) }
|
79
|
-
|
80
|
-
context 'Initialization:' do
|
81
|
-
it 'should be initialized with a token and a position' do
|
82
|
-
expect { SkmBoolean.new(dummy_token, pos) }.not_to raise_error
|
83
|
-
end
|
84
|
-
|
85
|
-
it 'should react positively to boolean? predicate' do
|
86
|
-
expect(subject).to be_boolean
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
context 'Provided services:' do
|
91
|
-
it 'should return its text representation' do
|
92
|
-
expect(subject.inspect).to eq('<Skeem::SkmBoolean: false>')
|
93
|
-
end
|
94
|
-
end # context
|
95
|
-
end # describe
|
96
|
-
|
97
|
-
describe SkmNumber do
|
98
|
-
let(:pos) { double('fake-position') }
|
99
|
-
let(:dummy_symbol) { double('dummy') }
|
100
|
-
let(:sample_value) { 0.5100 }
|
101
|
-
let(:dummy_token) do
|
102
|
-
obj = OpenStruct.new
|
103
|
-
obj.terminal = dummy_symbol
|
104
|
-
obj.lexeme = sample_value
|
105
|
-
obj
|
106
|
-
end
|
107
|
-
subject { SkmNumber.new(dummy_token, pos) }
|
108
|
-
|
109
|
-
context 'Initialization:' do
|
110
|
-
it 'should be initialized with a token and a position' do
|
111
|
-
expect { SkmNumber.new(dummy_token, pos) }.not_to raise_error
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
context 'Provided services:' do
|
116
|
-
it 'should react positively to number? predicate' do
|
117
|
-
expect(subject).to be_number
|
118
|
-
end
|
119
|
-
|
120
|
-
it 'should return its text representation' do
|
121
|
-
expect(subject.inspect).to eq('<Skeem::SkmNumber: 0.51>')
|
122
|
-
end
|
123
|
-
end # context
|
124
|
-
end # describe
|
125
|
-
|
126
|
-
describe SkmReal do
|
127
|
-
let(:pos) { double('fake-position') }
|
128
|
-
let(:dummy_symbol) { double('dummy') }
|
129
|
-
let(:sample_value) { 0.5100 }
|
130
|
-
let(:dummy_token) do
|
131
|
-
obj = OpenStruct.new
|
132
|
-
obj.terminal = dummy_symbol
|
133
|
-
obj.lexeme = sample_value
|
134
|
-
obj
|
135
|
-
end
|
136
|
-
subject { SkmReal.new(dummy_token, pos) }
|
137
|
-
|
138
|
-
context 'Provided services:' do
|
139
|
-
it 'should react positively to number? predicate' do
|
140
|
-
expect(subject).to be_number
|
141
|
-
end
|
142
|
-
|
143
|
-
it 'should react positively to real? predicate' do
|
144
|
-
expect(subject).to be_real
|
145
|
-
end
|
146
|
-
end
|
147
|
-
end # describe
|
148
|
-
|
149
|
-
describe SkmInteger do
|
150
|
-
let(:pos) { double('fake-position') }
|
151
|
-
let(:dummy_symbol) { double('dummy') }
|
152
|
-
let(:sample_value) { 3 }
|
153
|
-
let(:dummy_token) do
|
154
|
-
obj = OpenStruct.new
|
155
|
-
obj.terminal = dummy_symbol
|
156
|
-
obj.lexeme = sample_value
|
157
|
-
obj
|
158
|
-
end
|
159
|
-
subject { SkmInteger.new(dummy_token, pos) }
|
160
|
-
|
161
|
-
context 'Provided services:' do
|
162
|
-
it 'should react positively to number? predicate' do
|
163
|
-
expect(subject).to be_number
|
164
|
-
end
|
165
|
-
|
166
|
-
it 'should react positively to real? predicate' do
|
167
|
-
expect(subject).to be_real
|
168
|
-
end
|
169
|
-
|
170
|
-
it 'should react positively to integer? predicate' do
|
171
|
-
expect(subject).to be_real
|
172
|
-
end
|
173
|
-
end
|
174
|
-
end # describe
|
175
|
-
|
176
|
-
describe SkmString do
|
177
|
-
let(:pos) { double('fake-position') }
|
178
|
-
let(:dummy_symbol) { double('dummy') }
|
179
|
-
let(:sample_value) { 'Hello' }
|
180
|
-
let(:dummy_token) do
|
181
|
-
obj = OpenStruct.new
|
182
|
-
obj.terminal = dummy_symbol
|
183
|
-
obj.lexeme = sample_value
|
184
|
-
obj
|
185
|
-
end
|
186
|
-
subject { SkmString.new(dummy_token, pos) }
|
187
|
-
|
188
|
-
context 'Provided services:' do
|
189
|
-
it 'should react positively to string? predicate' do
|
190
|
-
expect(subject).to be_string
|
191
|
-
end
|
192
|
-
|
193
|
-
it 'should return its text representation' do
|
194
|
-
expect(subject.inspect).to eq('<Skeem::SkmString: Hello>')
|
195
|
-
end
|
196
|
-
end
|
197
|
-
end # describe
|
198
|
-
|
199
|
-
describe SkmIdentifier do
|
200
|
-
let(:pos) { double('fake-position') }
|
201
|
-
let(:dummy_symbol) { double('dummy') }
|
202
|
-
let(:sample_value) { 'this-is-it!' }
|
203
|
-
let(:dummy_token) do
|
204
|
-
obj = OpenStruct.new
|
205
|
-
obj.terminal = dummy_symbol
|
206
|
-
obj.lexeme = sample_value
|
207
|
-
obj
|
208
|
-
end
|
209
|
-
subject { SkmIdentifier.new(dummy_token, pos) }
|
210
|
-
|
211
|
-
context 'Provided services:' do
|
212
|
-
it 'should react positively to symbol? predicate' do
|
213
|
-
expect(subject).to be_symbol
|
214
|
-
end
|
215
|
-
|
216
|
-
it 'should return its text representation' do
|
217
|
-
expect(subject.inspect).to eq('<Skeem::SkmIdentifier: this-is-it!>')
|
218
|
-
end
|
219
|
-
end # context
|
220
|
-
end # describe
|
221
|
-
|
222
|
-
describe SkmList do
|
223
|
-
let(:sample_members) { [1, 2, 3] }
|
224
|
-
|
225
|
-
subject { SkmList.new(sample_members) }
|
226
|
-
|
227
|
-
context 'Initialization:' do
|
228
|
-
it 'should be initialized with its members' do
|
229
|
-
expect{ SkmList.new(sample_members) }.not_to raise_error
|
230
|
-
end
|
231
|
-
|
232
|
-
it 'should know its members' do
|
233
|
-
expect(subject.members).to eq(sample_members)
|
234
|
-
|
235
|
-
other = SkmList.new([])
|
236
|
-
expect(other.members).to be_empty
|
237
|
-
end
|
238
|
-
end # context
|
239
|
-
|
240
|
-
context 'Provided services:' do
|
241
|
-
it 'should retrieve its first member' do
|
242
|
-
expect(subject.first).to eq(1)
|
243
|
-
expect(subject.head).to eq(1)
|
244
|
-
end
|
245
|
-
|
246
|
-
it 'should retrieve its tail members' do
|
247
|
-
expect(subject.tail.inspect).to eq('<Skeem::SkmList: 2, 3>')
|
248
|
-
expect(subject.rest.inspect).to eq('<Skeem::SkmList: 2, 3>')
|
249
|
-
end
|
250
|
-
|
251
|
-
it 'should return its text representation' do
|
252
|
-
expect(subject.inspect).to eq('<Skeem::SkmList: 1, 2, 3>')
|
253
|
-
end
|
254
|
-
end # context
|
255
|
-
end # describe
|
256
|
-
|
257
|
-
|
258
7
|
describe SkmDefinition do
|
259
8
|
let(:pos) { double('fake-position') }
|
260
|
-
let(:sample_symbol) { SkmIdentifier.create('
|
9
|
+
let(:sample_symbol) { SkmIdentifier.create('ten') }
|
261
10
|
let(:sample_expr) { SkmInteger.create(10) }
|
262
11
|
|
263
12
|
subject { SkmDefinition.new(pos, sample_symbol, sample_expr) }
|
@@ -277,34 +26,23 @@ describe SkmIdentifier do
|
|
277
26
|
end # context
|
278
27
|
|
279
28
|
context 'Provided services:' do
|
280
|
-
|
281
|
-
txt1 = '<Skeem::SkmDefinition: <Skeem::SkmIdentifier: this-is-it!>,'
|
282
|
-
txt2 = ' <Skeem::SkmInteger: 10>>'
|
283
|
-
expect(subject.inspect).to eq(txt1 + txt2)
|
284
|
-
end
|
285
|
-
end # context
|
286
|
-
end # describe
|
287
|
-
|
288
|
-
describe SkmVariableReference do
|
289
|
-
let(:pos) { double('fake-position') }
|
290
|
-
let(:sample_symbol) { SkmIdentifier.create('this-is-it!') }
|
291
|
-
|
292
|
-
subject { SkmVariableReference.new(pos, sample_symbol) }
|
29
|
+
let(:runtime) { Runtime.new(Environment.new) }
|
293
30
|
|
294
|
-
|
295
|
-
|
296
|
-
|
31
|
+
it 'should create an entry when evaluating' do
|
32
|
+
expect(runtime).not_to include(sample_symbol)
|
33
|
+
subject.evaluate(runtime)
|
34
|
+
expect(runtime).to include(sample_symbol)
|
297
35
|
end
|
298
|
-
|
299
|
-
it 'should
|
300
|
-
|
36
|
+
|
37
|
+
it 'should quasiquote its variable and expression' do
|
38
|
+
alter_ego = subject.quasiquote(runtime)
|
39
|
+
expect(alter_ego).to eq(subject)
|
301
40
|
end
|
302
|
-
end # context
|
303
41
|
|
304
|
-
context 'Provided services:' do
|
305
42
|
it 'should return its text representation' do
|
306
|
-
txt1 = '<Skeem::
|
307
|
-
|
43
|
+
txt1 = '<Skeem::SkmDefinition: <Skeem::SkmIdentifier: ten>,'
|
44
|
+
txt2 = ' <Skeem::SkmInteger: 10>>'
|
45
|
+
expect(subject.inspect).to eq(txt1 + txt2)
|
308
46
|
end
|
309
47
|
end # context
|
310
48
|
end # describe
|
@@ -383,7 +121,7 @@ describe SkmIdentifier do
|
|
383
121
|
let(:s_body) do { defs: s_defs, sequence: s_sequence } end
|
384
122
|
|
385
123
|
subject { SkmLambda.new(pos, s_formals, s_body) }
|
386
|
-
|
124
|
+
|
387
125
|
context 'Initialization:' do
|
388
126
|
it 'should be initialized with a pos and 3 expressions' do
|
389
127
|
expect{ SkmLambda.new(pos, s_formals, s_body) }.not_to raise_error
|
@@ -0,0 +1,132 @@
|
|
1
|
+
require_relative '../spec_helper' # Use the RSpec framework
|
2
|
+
require_relative '../../lib/skeem/datum_dsl'
|
3
|
+
require_relative '../../lib/skeem/skm_compound_datum' # Load the classes under test
|
4
|
+
|
5
|
+
module Skeem
|
6
|
+
describe SkmCompoundDatum do
|
7
|
+
include DatumDSL
|
8
|
+
|
9
|
+
let(:sample_members) { [1, 2, 3] }
|
10
|
+
let(:sample_members) { [integer(1), integer(2), integer(3)] }
|
11
|
+
subject { SkmCompoundDatum.new(sample_members) }
|
12
|
+
|
13
|
+
context 'Initialization:' do
|
14
|
+
it 'should be initialized with its members' do
|
15
|
+
expect{ SkmCompoundDatum.new(sample_members) }.not_to raise_error
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should know its members' do
|
19
|
+
expect(subject.members).to eq(sample_members)
|
20
|
+
|
21
|
+
other = SkmCompoundDatum.new([])
|
22
|
+
expect(other.members).to be_empty
|
23
|
+
end
|
24
|
+
end # context
|
25
|
+
|
26
|
+
context 'Provided basic services:' do
|
27
|
+
it 'should assert that it is equal to itself' do
|
28
|
+
expect(subject).to eq(subject)
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should assert the equality by member values' do
|
32
|
+
# Comparison with other instances
|
33
|
+
expect(subject).to eq(SkmCompoundDatum.new(sample_members))
|
34
|
+
expect(subject).not_to eq(SkmCompoundDatum.new([]))
|
35
|
+
expect(subject).not_to eq(SkmCompoundDatum.new(sample_members.rotate))
|
36
|
+
|
37
|
+
# Comparison with array of values
|
38
|
+
expect(subject).to eq(sample_members)
|
39
|
+
expect(subject).not_to eq(sample_members.rotate)
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should respond to visitor' do
|
43
|
+
visitor = double('fake-visitor')
|
44
|
+
expect(visitor).to receive(:visit_compound_datum).with(subject)
|
45
|
+
expect { subject.accept(visitor) }.not_to raise_error
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'should return its text representation' do
|
49
|
+
txt1 = '<Skeem::SkmCompoundDatum: <Skeem::SkmInteger: 1>,'
|
50
|
+
txt2 = '<Skeem::SkmInteger: 2>, <Skeem::SkmInteger: 3>>'
|
51
|
+
expect(subject.inspect).to eq(txt1 + ' ' + txt2)
|
52
|
+
end
|
53
|
+
end # context
|
54
|
+
|
55
|
+
context 'Provided runtime services:' do
|
56
|
+
let(:quirk_datum) { double('two') }
|
57
|
+
let(:quirk_members) { [integer(1), quirk_datum, integer(3)] }
|
58
|
+
let(:runtime) { double('fake-runtime') }
|
59
|
+
|
60
|
+
it 'should evaluate its members' do
|
61
|
+
# subject contains simple literals
|
62
|
+
expect(subject.evaluate(runtime)).to eq(subject)
|
63
|
+
|
64
|
+
# Check that members receive the 'evaluate' message
|
65
|
+
expect(quirk_datum).to receive(:evaluate).with(runtime).and_return(integer(2))
|
66
|
+
instance = SkmCompoundDatum.new(quirk_members)
|
67
|
+
expect(instance.evaluate(runtime)).to eq(subject)
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'should quasiquoting its members' do
|
71
|
+
# subject contains simple literals
|
72
|
+
expect(subject.quasiquote(runtime)).to eq(subject)
|
73
|
+
|
74
|
+
# Check that members receive the 'quasiquote' message
|
75
|
+
expect(quirk_datum).to receive(:quasiquote).with(runtime).and_return(integer(2))
|
76
|
+
instance = SkmCompoundDatum.new(quirk_members)
|
77
|
+
expect(instance.quasiquote(runtime)).to eq(subject)
|
78
|
+
end
|
79
|
+
end # context
|
80
|
+
end # describe
|
81
|
+
|
82
|
+
describe SkmList do
|
83
|
+
let(:sample_members) { [1, 2, 3] }
|
84
|
+
subject { SkmList.new(sample_members) }
|
85
|
+
|
86
|
+
context 'Initialization:' do
|
87
|
+
it 'should be initialized with its members' do
|
88
|
+
expect{ SkmList.new(sample_members) }.not_to raise_error
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'should react positively to list? predicate' do
|
92
|
+
expect(subject).to be_list
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'should react correctly to null? predicate' do
|
96
|
+
expect(subject).not_to be_null
|
97
|
+
expect(SkmList.new([])).to be_null
|
98
|
+
end
|
99
|
+
end # context
|
100
|
+
|
101
|
+
context 'Provided services:' do
|
102
|
+
it 'should retrieve its first member' do
|
103
|
+
expect(subject.first).to eq(1)
|
104
|
+
expect(subject.head).to eq(1)
|
105
|
+
end
|
106
|
+
|
107
|
+
it 'should retrieve its tail members' do
|
108
|
+
expect(subject.tail.inspect).to eq('<Skeem::SkmList: 2, 3>')
|
109
|
+
expect(subject.rest.inspect).to eq('<Skeem::SkmList: 2, 3>')
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'should return its text representation' do
|
113
|
+
expect(subject.inspect).to eq('<Skeem::SkmList: 1, 2, 3>')
|
114
|
+
end
|
115
|
+
end # context
|
116
|
+
end # describe
|
117
|
+
|
118
|
+
describe SkmVector do
|
119
|
+
let(:sample_members) { [1, 2, 3] }
|
120
|
+
subject { SkmVector.new(sample_members) }
|
121
|
+
|
122
|
+
context 'Initialization:' do
|
123
|
+
it 'should be initialized with its members' do
|
124
|
+
expect{ SkmVector.new(sample_members) }.not_to raise_error
|
125
|
+
end
|
126
|
+
|
127
|
+
it 'should react positively to vector? predicate' do
|
128
|
+
expect(subject).to be_vector
|
129
|
+
end
|
130
|
+
end # context
|
131
|
+
end # describe
|
132
|
+
end # module
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require_relative '../spec_helper' # Use the RSpec framework
|
2
|
+
require_relative '../../lib/skeem/skm_element' # Load the class under test
|
3
|
+
|
4
|
+
module Skeem
|
5
|
+
describe SkmElement do
|
6
|
+
let(:pos) { double('fake-position') }
|
7
|
+
subject { SkmElement.new(pos) }
|
8
|
+
|
9
|
+
context 'Initialization:' do
|
10
|
+
it 'should be initialized with a position' do
|
11
|
+
expect { SkmElement.new(pos) }.not_to raise_error
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should know its position' do
|
15
|
+
expect(subject.position).to eq(pos)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Default (overridable) behavior of SkmElement
|
19
|
+
it 'should react by default to predicates' do
|
20
|
+
expect(subject).not_to be_boolean
|
21
|
+
expect(subject).not_to be_number
|
22
|
+
expect(subject).not_to be_real
|
23
|
+
expect(subject).not_to be_integer
|
24
|
+
expect(subject).not_to be_string
|
25
|
+
expect(subject).not_to be_symbol
|
26
|
+
expect(subject).not_to be_list
|
27
|
+
expect(subject).not_to be_null
|
28
|
+
expect(subject).not_to be_vector
|
29
|
+
end
|
30
|
+
end # context
|
31
|
+
|
32
|
+
context 'Provided services:' do
|
33
|
+
let(:runtime) { double('fake-runtime') }
|
34
|
+
let(:visitor) { double('fake-visitor') }
|
35
|
+
let(:not_implemented) { NotImplementedError }
|
36
|
+
|
37
|
+
it "should complain when receiving 'evaluate' message" do
|
38
|
+
expect { subject.evaluate(runtime) }.to raise_error(not_implemented)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should complain when receiving 'quasiquote' message" do
|
42
|
+
expect { subject.quasiquote(runtime) }.to raise_error(not_implemented)
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should complain when receiving 'accept' message" do
|
46
|
+
expect { subject.accept(visitor) }.to raise_error(not_implemented)
|
47
|
+
end
|
48
|
+
end # context
|
49
|
+
end # describe
|
50
|
+
end # module
|