delorean_lang 0.6.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/spec/func_spec.rb CHANGED
@@ -13,7 +13,7 @@ describe 'Delorean' do
13
13
  )
14
14
 
15
15
  r = engine.evaluate('MAX', 'a')
16
- r.should == 3
16
+ expect(r).to eq(3)
17
17
  end
18
18
 
19
19
  it 'should handle COMPACT' do
@@ -32,7 +32,7 @@ describe 'Delorean' do
32
32
  )
33
33
 
34
34
  r = engine.evaluate('A', 'a')
35
- r.should == -3
35
+ expect(r).to eq(-3)
36
36
  end
37
37
 
38
38
  it 'should handle ROUND' do
@@ -43,7 +43,7 @@ describe 'Delorean' do
43
43
  )
44
44
 
45
45
  r = engine.evaluate('A', ['a', 'b', 'c'])
46
- r.should == [12.35, 12.3, 12]
46
+ expect(r).to eq([12.35, 12.3, 12])
47
47
  end
48
48
 
49
49
  it 'should handle TRUNCATE' do
@@ -54,7 +54,7 @@ describe 'Delorean' do
54
54
  )
55
55
 
56
56
  r = engine.evaluate('A', ['a', 'b', 'c'])
57
- r.should == [12.34, 12.3, 12]
57
+ expect(r).to eq([12.34, 12.3, 12])
58
58
  end
59
59
 
60
60
  it 'should handle FLOOR' do
@@ -63,7 +63,7 @@ describe 'Delorean' do
63
63
  )
64
64
 
65
65
  r = engine.evaluate('A', 'a')
66
- r.should == [12, 13]
66
+ expect(r).to eq([12, 13])
67
67
  end
68
68
 
69
69
  it 'should handle TO_F' do
@@ -75,7 +75,7 @@ describe 'Delorean' do
75
75
  )
76
76
 
77
77
  r = engine.evaluate('A', ['a', 'b', 'c', 'd'])
78
- r.should == [12.3456, 12.3456, 12, 1_525_456_587.0]
78
+ expect(r).to eq([12.3456, 12.3456, 12, 1_525_456_587.0])
79
79
  end
80
80
 
81
81
  it 'should handle ABS' do
@@ -87,7 +87,7 @@ describe 'Delorean' do
87
87
  )
88
88
 
89
89
  r = engine.evaluate('A', ['a', 'b', 'c', 'd'])
90
- r.should == [123, 1.1, 2.3, 0]
90
+ expect(r).to eq([123, 1.1, 2.3, 0])
91
91
  end
92
92
 
93
93
  it 'should handle STRING' do
@@ -98,7 +98,7 @@ describe 'Delorean' do
98
98
  )
99
99
 
100
100
  r = engine.evaluate('A', ['a', 'b', 'c'])
101
- r.should == ['hello', '12.3456', [1, 2, 3].to_s]
101
+ expect(r).to eq(['hello', '12.3456', [1, 2, 3].to_s])
102
102
  end
103
103
 
104
104
  it 'should handle FETCH' do
@@ -110,7 +110,7 @@ describe 'Delorean' do
110
110
  )
111
111
 
112
112
  r = engine.evaluate('A', ['a', 'b', 'c'])
113
- r.should == [123, 111, 456]
113
+ expect(r).to eq([123, 111, 456])
114
114
  end
115
115
 
116
116
  it 'should handle TIMEPART' do
@@ -126,10 +126,10 @@ describe 'Delorean' do
126
126
  p = Time.now
127
127
  params = { 'p' => p }
128
128
  r = engine.evaluate('A', %w[h m s d e], params)
129
- r.should == [p.hour, p.min, p.sec, p.to_date, p.to_date]
129
+ expect(r).to eq([p.hour, p.min, p.sec, p.to_date, p.to_date])
130
130
 
131
131
  # Non time argument should raise an error
132
- expect { engine.evaluate('A', ['m'], 'p' => 123) }.to raise_error
132
+ expect { engine.evaluate('A', ['m'], 'p' => 123) }.to raise_error(RuntimeError)
133
133
  end
134
134
 
135
135
  it 'should handle DATEPART' do
@@ -142,12 +142,12 @@ describe 'Delorean' do
142
142
 
143
143
  p = Date.today
144
144
  r = engine.evaluate('A', ['y', 'd', 'm'], 'p' => p)
145
- r.should == [p.year, p.day, p.month]
145
+ expect(r).to eq([p.year, p.day, p.month])
146
146
 
147
147
  # Non date argument should raise an error
148
148
  expect do
149
149
  engine.evaluate('A', ['y', 'd', 'm'], 'p' => 123)
150
- end.to raise_error
150
+ end.to raise_error(RuntimeError)
151
151
  end
152
152
 
153
153
  it 'should handle FLATTEN' do
@@ -158,7 +158,7 @@ describe 'Delorean' do
158
158
  ' b = a.flatten() + a.flatten(1)'
159
159
  )
160
160
 
161
- engine.evaluate('A', 'b').should == x.flatten + x.flatten(1)
161
+ expect(engine.evaluate('A', 'b')).to eq(x.flatten + x.flatten(1))
162
162
  end
163
163
 
164
164
  it 'should handle ZIP' do
@@ -173,7 +173,7 @@ describe 'Delorean' do
173
173
  ' d = a.zip(b) + a.zip(b, c)',
174
174
  )
175
175
 
176
- expect(engine.evaluate('A', 'd')).to eq a.zip(b) + a.zip(b, c)
176
+ expect(engine.evaluate('A', 'd')).to eq(a.zip(b) + a.zip(b, c))
177
177
  end
178
178
 
179
179
  it 'should handle ERR' do
@@ -184,9 +184,7 @@ describe 'Delorean' do
184
184
 
185
185
  expect { engine.evaluate('A', 'a') }.to raise_error('hello')
186
186
 
187
- lambda {
188
- engine.evaluate('A', 'b')
189
- }.should raise_error('xx, 1, 2, 3')
187
+ expect { engine.evaluate('A', 'b') }.to raise_error('xx, 1, 2, 3')
190
188
  end
191
189
 
192
190
  it 'should handle RUBY' do
@@ -208,30 +206,27 @@ describe 'Delorean' do
208
206
  " o = 'hello'.length",
209
207
  )
210
208
 
211
- engine.evaluate('A', 'c').should == x.flatten(1)
212
- engine.evaluate('A', 'd').should == x.flatten + x.flatten(1)
209
+ expect(engine.evaluate('A', 'c')).to eq(x.flatten(1))
210
+ expect(engine.evaluate('A', 'd')).to eq(x.flatten + x.flatten(1))
213
211
  dd = engine.evaluate('A', 'dd')
214
- engine.evaluate('A', 'e').should == dd.sort
215
- engine.evaluate('A', 'f').should == dd.sort.uniq
216
- engine.evaluate('A', 'g').should == dd.length
217
- engine.evaluate('A', 'gg').should == x.length
218
- engine.evaluate('A', 'm').should == [x.member?(5), x.member?(55)]
219
- engine.evaluate('A', 'n').should == 3
220
- engine.evaluate('A', 'o').should == 5
212
+ expect(engine.evaluate('A', 'e')).to eq(dd.sort)
213
+ expect(engine.evaluate('A', 'f')).to eq(dd.sort.uniq)
214
+ expect(engine.evaluate('A', 'g')).to eq(dd.length)
215
+ expect(engine.evaluate('A', 'gg')).to eq(x.length)
216
+ expect(engine.evaluate('A', 'm')).to eq([x.member?(5), x.member?(55)])
217
+ expect(engine.evaluate('A', 'n')).to eq(3)
218
+ expect(engine.evaluate('A', 'o')).to eq(5)
221
219
  end
222
220
 
223
221
  it 'should be able to call function on hash' do
224
- # FIXME: this is actually a Delorean design issue. How do
225
- # whitelisted functions interact with attrs? In this case, we
226
- # return nil since there is no Delorean 'length' attr in the hash.
227
- skip 'Delorean design issue to be resolved'
228
-
229
222
  engine.parse defn('A:',
230
- ' n = {}.length',
231
223
  " m = {'length':100}.length",
224
+ ' n = {}.length',
225
+ ' o = {}["length"]',
232
226
  )
233
- engine.evaluate('A', 'n').should == 0
234
- engine.evaluate('A', 'm').should == 100
227
+ expect(engine.evaluate('A', 'n')).to eq(0)
228
+ expect(engine.evaluate('A', 'm')).to eq(100)
229
+ expect(engine.evaluate('A', 'o')).to be_nil
235
230
  end
236
231
 
237
232
  it 'should be able to call hash except' do
@@ -249,7 +244,7 @@ describe 'Delorean' do
249
244
  " a = #{x}",
250
245
  ' b = a.slice(0, 4)',
251
246
  )
252
- engine.evaluate('A', 'b').should == x.slice(0, 4)
247
+ expect(engine.evaluate('A', 'b')).to eq(x.slice(0, 4))
253
248
  end
254
249
 
255
250
  it 'should handle RUBY empty? function' do
@@ -262,7 +257,9 @@ describe 'Delorean' do
262
257
  ' c1 = {1,2,3}',
263
258
  ' res = [a0.empty, b0.empty(), c0.empty, a1.empty, b1.empty(), c1.empty]',
264
259
  )
265
- engine.evaluate('A', 'res').should == [true, true, true, false, false, false]
260
+ expect(engine.evaluate('A', 'res')).to eq(
261
+ [true, true, true, false, false, false]
262
+ )
266
263
  end
267
264
 
268
265
  it 'should handle BETWEEN' do
data/spec/parse_spec.rb CHANGED
@@ -59,97 +59,97 @@ describe 'Delorean' do
59
59
  end
60
60
 
61
61
  it 'should accept default param definitions' do
62
- lambda {
62
+ expect do
63
63
  engine.parse defn('A:',
64
64
  ' a =? 0.0123',
65
65
  ' b =? 0',
66
66
  ' c =? -1.1',
67
67
  ' d = b + c',
68
68
  )
69
- }.should_not raise_error
69
+ end.not_to raise_error
70
70
  end
71
71
 
72
72
  it 'gives errors with attrs not in node' do
73
- lambda {
73
+ expect do
74
74
  engine.parse defn('a = 123',
75
75
  'b = a * 2',
76
76
  )
77
- }.should raise_error(Delorean::ParseError)
77
+ end.to raise_error(Delorean::ParseError)
78
78
  end
79
79
 
80
80
  it 'should disallow .<digits> literals' do
81
- lambda {
81
+ expect do
82
82
  engine.parse defn('A:',
83
83
  ' a = .123',
84
84
  )
85
- }.should raise_error(Delorean::ParseError)
85
+ end.to raise_error(Delorean::ParseError)
86
86
  end
87
87
 
88
88
  it 'should disallow leading 0s in numbers' do
89
- lambda {
89
+ expect do
90
90
  engine.parse defn('A:',
91
91
  ' a = 00.123',
92
92
  )
93
- }.should raise_error(Delorean::ParseError)
93
+ end.to raise_error(Delorean::ParseError)
94
94
  end
95
95
 
96
96
  it 'should disallow leading 0s in numbers (2)' do
97
- lambda {
97
+ expect do
98
98
  engine.parse defn('A:',
99
99
  ' a = 0123',
100
100
  )
101
- }.should raise_error(Delorean::ParseError)
101
+ end.to raise_error(Delorean::ParseError)
102
102
  end
103
103
 
104
104
  it 'should disallow bad attr names' do
105
- lambda {
105
+ expect do
106
106
  engine.parse defn('A:',
107
107
  ' B = 1',
108
108
  )
109
- }.should raise_error(Delorean::ParseError)
109
+ end.to raise_error(Delorean::ParseError)
110
110
 
111
111
  engine.reset
112
112
 
113
- lambda {
113
+ expect do
114
114
  engine.parse defn('A:',
115
115
  ' _b = 1',
116
116
  )
117
- }.should raise_error(Delorean::ParseError)
117
+ end.to raise_error(Delorean::ParseError)
118
118
  end
119
119
 
120
120
  it 'should disallow bad node names' do
121
- lambda {
121
+ expect do
122
122
  engine.parse defn('a:',
123
123
  )
124
- }.should raise_error(Delorean::ParseError)
124
+ end.to raise_error(Delorean::ParseError)
125
125
 
126
126
  engine.reset
127
127
 
128
- lambda {
128
+ expect do
129
129
  engine.parse defn('_A:',
130
130
  )
131
- }.should raise_error(Delorean::ParseError)
131
+ end.to raise_error(Delorean::ParseError)
132
132
  end
133
133
 
134
134
  it 'should disallow recursion' do
135
- lambda {
135
+ expect do
136
136
  engine.parse defn('A:',
137
137
  ' a = 1',
138
138
  'B: A',
139
139
  ' a = a + 1',
140
140
  )
141
- }.should raise_error(Delorean::RecursionError)
141
+ end.to raise_error(Delorean::RecursionError)
142
142
 
143
143
  engine.reset
144
144
 
145
- lambda {
145
+ expect do
146
146
  engine.parse defn('A:',
147
147
  ' a = 1',
148
148
  'B: A',
149
149
  ' b = a',
150
150
  ' a = b',
151
151
  )
152
- }.should raise_error(Delorean::RecursionError)
152
+ end.to raise_error(Delorean::RecursionError)
153
153
  end
154
154
 
155
155
  it 'should allow getattr in expressions' do
@@ -197,194 +197,194 @@ describe 'Delorean' do
197
197
  end
198
198
 
199
199
  it 'should check for recursion with default params 1' do
200
- lambda {
200
+ expect do
201
201
  engine.parse defn('A:',
202
202
  ' a =? a',
203
203
  )
204
- }.should raise_error(Delorean::UndefinedError)
204
+ end.to raise_error(Delorean::UndefinedError)
205
205
  end
206
206
 
207
207
  it 'should check for recursion with default params 2' do
208
- lambda {
208
+ expect do
209
209
  engine.parse defn('A:',
210
210
  ' a = 1',
211
211
  'B: A',
212
212
  ' b =? a',
213
213
  ' a =? b',
214
214
  )
215
- }.should raise_error(Delorean::RecursionError)
215
+ end.to raise_error(Delorean::RecursionError)
216
216
  end
217
217
 
218
218
  it 'gives errors for attrs defined more than once in a node' do
219
- lambda {
219
+ expect do
220
220
  engine.parse defn('B:',
221
221
  ' b = 1 + 1',
222
222
  ' b = 123',
223
223
  )
224
- }.should raise_error(Delorean::RedefinedError)
224
+ end.to raise_error(Delorean::RedefinedError)
225
225
 
226
226
  engine.reset
227
227
 
228
- lambda {
228
+ expect do
229
229
  engine.parse defn('B:',
230
230
  ' b =?',
231
231
  ' b = 123',
232
232
  )
233
- }.should raise_error(Delorean::RedefinedError)
233
+ end.to raise_error(Delorean::RedefinedError)
234
234
 
235
235
  engine.reset
236
236
 
237
- lambda {
237
+ expect do
238
238
  engine.parse defn('B:',
239
239
  ' b =? 22',
240
240
  ' b = 123',
241
241
  )
242
- }.should raise_error(Delorean::RedefinedError)
242
+ end.to raise_error(Delorean::RedefinedError)
243
243
  end
244
244
 
245
245
  it 'should raise error for nodes defined more than once' do
246
- lambda {
246
+ expect do
247
247
  engine.parse defn('B:',
248
248
  ' b =?',
249
249
  'B:',
250
250
  )
251
- }.should raise_error(Delorean::RedefinedError)
251
+ end.to raise_error(Delorean::RedefinedError)
252
252
 
253
253
  engine.reset
254
254
 
255
- lambda {
255
+ expect do
256
256
  engine.parse defn('B:',
257
257
  'A:',
258
258
  'B:',
259
259
  )
260
- }.should raise_error(Delorean::RedefinedError)
260
+ end.to raise_error(Delorean::RedefinedError)
261
261
  end
262
262
 
263
263
  it 'should not be valid to derive from undefined nodes' do
264
- lambda {
264
+ expect do
265
265
  engine.parse defn('A: B',
266
266
  ' a = 456 * 123',
267
267
  )
268
- }.should raise_error(Delorean::UndefinedError)
268
+ end.to raise_error(Delorean::UndefinedError)
269
269
  end
270
270
 
271
271
  it 'should not be valid to use an undefined attr' do
272
- lambda {
272
+ expect do
273
273
  engine.parse defn('A:',
274
274
  ' a = 456 * 123',
275
275
  'B: A',
276
276
  ' b = a',
277
277
  ' c = d',
278
278
  )
279
- }.should raise_error(Delorean::UndefinedError)
279
+ end.to raise_error(Delorean::UndefinedError)
280
280
  end
281
281
 
282
282
  it 'should not be possible to use a forward definition in hash' do
283
- lambda {
283
+ expect do
284
284
  engine.parse defn('A:',
285
285
  " c = {'b': 1, 'd' : d}",
286
286
  ' d = 789',
287
287
  )
288
- }.should raise_error(Delorean::UndefinedError)
288
+ end.to raise_error(Delorean::UndefinedError)
289
289
  end
290
290
 
291
291
  it 'should not be possible to use a forward definition in node call' do
292
- lambda {
292
+ expect do
293
293
  engine.parse defn('A:',
294
294
  ' c = A(b=1, d=d)',
295
295
  ' d = 789',
296
296
  )
297
- }.should raise_error(Delorean::UndefinedError)
297
+ end.to raise_error(Delorean::UndefinedError)
298
298
  end
299
299
 
300
300
  it 'should not be possible to use a forward definition in array' do
301
- lambda {
301
+ expect do
302
302
  engine.parse defn('A:',
303
303
  ' c = [123, 456, d]',
304
304
  ' d = 789',
305
305
  )
306
- }.should raise_error(Delorean::UndefinedError)
306
+ end.to raise_error(Delorean::UndefinedError)
307
307
  end
308
308
 
309
309
  it 'should be able to use ruby keywords as identifier' do
310
- lambda {
310
+ expect do
311
311
  engine.parse defn('A:',
312
312
  ' in = 123',
313
313
  )
314
- }.should_not raise_error
314
+ end.not_to raise_error
315
315
 
316
316
  engine.reset
317
317
 
318
- lambda {
318
+ expect do
319
319
  engine.parse defn('B:',
320
320
  ' in1 = 123',
321
321
  )
322
- }.should_not raise_error
322
+ end.not_to raise_error
323
323
 
324
324
  engine.reset
325
325
 
326
- lambda {
326
+ expect do
327
327
  engine.parse defn('C:',
328
328
  ' ifx = 123',
329
329
  ' elsey = ifx + 1',
330
330
  )
331
- }.should_not raise_error
331
+ end.not_to raise_error
332
332
 
333
333
  engine.reset
334
334
 
335
- lambda {
335
+ expect do
336
336
  engine.parse defn('D:',
337
337
  ' true = false',
338
338
  )
339
- }.should_not raise_error
339
+ end.not_to raise_error
340
340
 
341
341
  engine.reset
342
342
 
343
- lambda {
343
+ expect do
344
344
  engine.parse defn('E:',
345
345
  ' a = 1',
346
346
  ' return=a',
347
347
  )
348
- }.should_not raise_error
348
+ end.not_to raise_error
349
349
 
350
350
  engine.reset
351
351
 
352
352
  skip 'need to fix'
353
353
 
354
- lambda {
354
+ expect do
355
355
  engine.parse defn('D:',
356
356
  ' true_1 = false',
357
357
  ' false_1 = true_1',
358
358
  ' nil_1 = false_1',
359
359
  )
360
- }.should_not raise_error
360
+ end.not_to raise_error
361
361
 
362
362
  engine.reset
363
363
  end
364
364
 
365
365
  it 'should parse calls followed by getattr' do
366
- lambda {
366
+ expect do
367
367
  engine.parse defn('A:',
368
368
  ' a = -1',
369
369
  ' b = A().a',
370
370
  )
371
- }.should_not raise_error
371
+ end.not_to raise_error
372
372
  end
373
373
 
374
374
  it 'should be able to chain method calls on model functions' do
375
- lambda {
375
+ expect do
376
376
  engine.parse defn('A:',
377
377
  " b = Dummy.i_just_met_you('CRJ', 123).name"
378
378
  )
379
- }.should_not raise_error
379
+ end.not_to raise_error
380
380
  end
381
381
 
382
382
  it 'should be able to pass model class to model functions' do
383
- lambda {
383
+ expect do
384
384
  engine.parse defn('A:',
385
385
  ' b = Dummy.i_just_met_you(Dummy, 1)'
386
386
  )
387
- }.should_not raise_error
387
+ end.not_to raise_error
388
388
  end
389
389
 
390
390
  it 'should be able to call class methods on ActiveRecord classes' do
@@ -436,7 +436,7 @@ describe 'Delorean' do
436
436
  end
437
437
 
438
438
  it 'should not be able to access attrs not defined in ancestors' do
439
- lambda {
439
+ expect do
440
440
  engine.parse defn('A:',
441
441
  ' b =? 22',
442
442
  'B: A',
@@ -444,7 +444,7 @@ describe 'Delorean' do
444
444
  'C: A',
445
445
  ' d =? c * b + 11',
446
446
  )
447
- }.should raise_error(Delorean::UndefinedError)
447
+ end.to raise_error(Delorean::UndefinedError)
448
448
  end
449
449
 
450
450
  it 'should be able to access specific node attrs ' do
@@ -472,11 +472,11 @@ describe 'Delorean' do
472
472
 
473
473
  engine.reset
474
474
 
475
- lambda {
475
+ expect do
476
476
  engine.parse defn('B:',
477
477
  ' c = b.x.y.z',
478
478
  )
479
- }.should raise_error(Delorean::UndefinedError)
479
+ end.to raise_error(Delorean::UndefinedError)
480
480
  end
481
481
 
482
482
  it 'should handle lines with comments' do
@@ -495,8 +495,8 @@ describe 'Delorean' do
495
495
  rescue StandardError => exc
496
496
  end
497
497
 
498
- exc.module_name.should == 'YYY'
499
- exc.line.should == 3
498
+ expect(exc.module_name).to eq('YYY')
499
+ expect(exc.line).to eq(3)
500
500
 
501
501
  engine.reset
502
502
 
@@ -507,8 +507,8 @@ describe 'Delorean' do
507
507
  rescue StandardError => exc
508
508
  end
509
509
 
510
- exc.module_name.should == 'YYY'
511
- exc.line.should == 2
510
+ expect(exc.module_name).to eq('YYY')
511
+ expect(exc.line).to eq(2)
512
512
  end
513
513
 
514
514
  it 'correctly report error line during parse' do
@@ -521,32 +521,32 @@ describe 'Delorean' do
521
521
  rescue StandardError => exc
522
522
  end
523
523
 
524
- exc.module_name.should == 'YYY'
525
- exc.line.should == 2
524
+ expect(exc.module_name).to eq('YYY')
525
+ expect(exc.line).to eq(2)
526
526
  end
527
527
 
528
528
  it 'should raise error on malformed string' do
529
- lambda {
529
+ expect do
530
530
  engine.parse defn('A:',
531
531
  ' d = "testing"" ',
532
532
  )
533
- }.should raise_error(Delorean::ParseError)
533
+ end.to raise_error(Delorean::ParseError)
534
534
  end
535
535
 
536
536
  it 'should not allow inherited ruby methods as attrs' do
537
- lambda {
537
+ expect do
538
538
  engine.parse defn('A:',
539
539
  ' a = name',
540
540
  )
541
- }.should raise_error(Delorean::UndefinedError)
541
+ end.to raise_error(Delorean::UndefinedError)
542
542
 
543
543
  engine.reset
544
544
 
545
- lambda {
545
+ expect do
546
546
  engine.parse defn('A:',
547
547
  ' a = new',
548
548
  )
549
- }.should raise_error(Delorean::UndefinedError)
549
+ end.to raise_error(Delorean::UndefinedError)
550
550
  end
551
551
 
552
552
  it 'should be able to parse lists' do
@@ -559,19 +559,19 @@ describe 'Delorean' do
559
559
 
560
560
  engine.reset
561
561
 
562
- lambda {
562
+ expect do
563
563
  engine.parse defn('A:',
564
564
  ' a = [',
565
565
  )
566
- }.should raise_error(Delorean::ParseError)
566
+ end.to raise_error(Delorean::ParseError)
567
567
 
568
568
  engine.reset
569
569
 
570
- lambda {
570
+ expect do
571
571
  engine.parse defn('A:',
572
572
  ' a = []-',
573
573
  )
574
- }.should raise_error(Delorean::ParseError)
574
+ end.to raise_error(Delorean::ParseError)
575
575
  end
576
576
 
577
577
  it "should handle trailing ',' with lists" do
@@ -581,19 +581,19 @@ describe 'Delorean' do
581
581
 
582
582
  engine.reset
583
583
 
584
- lambda {
584
+ expect do
585
585
  engine.parse defn('A:',
586
586
  ' a = [,]',
587
587
  )
588
- }.should raise_error(Delorean::ParseError)
588
+ end.to raise_error(Delorean::ParseError)
589
589
 
590
590
  engine.reset
591
591
 
592
- lambda {
592
+ expect do
593
593
  engine.parse defn('A:',
594
594
  ' a = [1,2,,]',
595
595
  )
596
- }.should raise_error(Delorean::ParseError)
596
+ end.to raise_error(Delorean::ParseError)
597
597
  end
598
598
 
599
599
  it 'should be able to parse hashes' do
@@ -605,19 +605,19 @@ describe 'Delorean' do
605
605
 
606
606
  engine.reset
607
607
 
608
- lambda {
608
+ expect do
609
609
  engine.parse defn('A:',
610
610
  ' a = {',
611
611
  )
612
- }.should raise_error(Delorean::ParseError)
612
+ end.to raise_error(Delorean::ParseError)
613
613
 
614
614
  engine.reset
615
615
 
616
- lambda {
616
+ expect do
617
617
  engine.parse defn('A:',
618
618
  ' a = {}+',
619
619
  )
620
- }.should raise_error(Delorean::ParseError)
620
+ end.to raise_error(Delorean::ParseError)
621
621
  end
622
622
 
623
623
  it 'should be able to parse conditional hash literals' do
@@ -634,19 +634,19 @@ describe 'Delorean' do
634
634
 
635
635
  engine.reset
636
636
 
637
- lambda {
637
+ expect do
638
638
  engine.parse defn('A:',
639
639
  ' a = {,}',
640
640
  )
641
- }.should raise_error(Delorean::ParseError)
641
+ end.to raise_error(Delorean::ParseError)
642
642
 
643
643
  engine.reset
644
644
 
645
- lambda {
645
+ expect do
646
646
  engine.parse defn('A:',
647
647
  ' a = {-1:1,,}',
648
648
  )
649
- }.should raise_error(Delorean::ParseError)
649
+ end.to raise_error(Delorean::ParseError)
650
650
  end
651
651
 
652
652
  it 'should be able to parse list operations ' do
@@ -693,26 +693,26 @@ describe 'Delorean' do
693
693
  end
694
694
 
695
695
  it 'errors out on bad list comprehension' do
696
- lambda {
696
+ expect do
697
697
  engine.parse defn('A:',
698
698
  ' b = [i+1 for x in [1,2,3]]',
699
699
  )
700
- }.should raise_error(Delorean::UndefinedError)
700
+ end.to raise_error(Delorean::UndefinedError)
701
701
  engine.reset
702
702
 
703
- lambda {
703
+ expect do
704
704
  engine.parse defn('A:',
705
705
  ' a = [123 for b in b]',
706
706
  )
707
- }.should raise_error(Delorean::UndefinedError)
707
+ end.to raise_error(Delorean::UndefinedError)
708
708
  engine.reset
709
709
 
710
710
  # disallow nested comprehension var reuse
711
- lambda {
711
+ expect do
712
712
  engine.parse defn('A:',
713
713
  ' b = [[a+1 for a in [4,5]] for a in [1,2,3]]',
714
714
  )
715
- }.should raise_error(Delorean::RedefinedError)
715
+ end.to raise_error(Delorean::RedefinedError)
716
716
  engine.reset
717
717
  end
718
718
 
@@ -815,7 +815,7 @@ describe 'Delorean' do
815
815
  )
816
816
  raise
817
817
  rescue Delorean::ParseError => exc
818
- exc.line.should == 2
818
+ expect(exc.line).to eq(2)
819
819
  end
820
820
  end
821
821
 
@@ -828,7 +828,7 @@ describe 'Delorean' do
828
828
  )
829
829
  raise
830
830
  rescue Delorean::ParseError => exc
831
- exc.line.should == 3
831
+ expect(exc.line).to eq(3)
832
832
  end
833
833
  end
834
834
 
@@ -842,7 +842,7 @@ describe 'Delorean' do
842
842
  )
843
843
  raise
844
844
  rescue Delorean::ParseError => exc
845
- exc.line.should == 3
845
+ expect(exc.line).to eq(3)
846
846
  end
847
847
  end
848
848
 
@@ -855,7 +855,7 @@ describe 'Delorean' do
855
855
  )
856
856
  raise
857
857
  rescue Delorean::ParseError => exc
858
- exc.line.should == 2
858
+ expect(exc.line).to eq(2)
859
859
  end
860
860
  end
861
861
 
@@ -867,7 +867,7 @@ describe 'Delorean' do
867
867
  )
868
868
  raise
869
869
  rescue Delorean::ParseError => exc
870
- exc.line.should == 2
870
+ expect(exc.line).to eq(2)
871
871
  end
872
872
  end
873
873