aslakhellesoy-cucumber 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,10 @@
1
+ == 0.3.5 2009-05-14
2
+
3
+ Let's make a new release today because two annoying bugs are fixed.
4
+
5
+ === Bugfixes
6
+ * Allow feature element names to contain Gherkin keywords as long as they are not the first word on a newline (#319, #307 Joseph Wilk)
7
+
1
8
  == 0.3.4 2009-05-14
2
9
 
3
10
  A couple of great new features in this release. Running with Rake is faster than before,
@@ -35,6 +42,7 @@ However, setting the RAILS_ENV is easy to forget, so I don't recommend relying o
35
42
  * Support for Catalan (Francesc Esplugas)
36
43
 
37
44
  === Changed features
45
+ * --exclude flag now works on ruby files in addition to feature files (#312 Ben Mabey)
38
46
  * The Java example under examples/java uses Ant instead of Rake - and the new JUnit formatter.
39
47
  * Rake task should not shell out (#297 Aslak Hellesøy)
40
48
  The Cucumber Rake task will run Cucumber in the same Ruby interpreter as Rake itself
@@ -1331,187 +1331,168 @@ module Cucumber
1331
1331
  return r0
1332
1332
  end
1333
1333
 
1334
- module LineToKeyword0
1335
- end
1336
-
1337
- module LineToKeyword1
1338
- def white
1334
+ module LinesToKeyword0
1335
+ def eol
1339
1336
  elements[0]
1340
1337
  end
1341
1338
 
1342
- def text
1343
- elements[1]
1339
+ def reserved_words_and_symbols
1340
+ elements[2]
1344
1341
  end
1345
1342
  end
1346
1343
 
1347
- module LineToKeyword2
1344
+ module LinesToKeyword1
1345
+ end
1346
+
1347
+ module LinesToKeyword2
1348
1348
  def build
1349
- text.text_value.strip
1349
+ self.text_value.split("\n").map{|s| s.strip }.join("\n")
1350
1350
  end
1351
1351
  end
1352
1352
 
1353
- def _nt_line_to_keyword
1353
+ def _nt_lines_to_keyword
1354
1354
  start_index = index
1355
- if node_cache[:line_to_keyword].has_key?(index)
1356
- cached = node_cache[:line_to_keyword][index]
1355
+ if node_cache[:lines_to_keyword].has_key?(index)
1356
+ cached = node_cache[:lines_to_keyword][index]
1357
1357
  @index = cached.interval.end if cached
1358
1358
  return cached
1359
1359
  end
1360
1360
 
1361
- i0, s0 = index, []
1362
- r1 = _nt_white
1363
- s0 << r1
1364
- if r1
1365
- s2, i2 = [], index
1366
- loop do
1367
- i3, s3 = index, []
1368
- i4 = index
1369
- r5 = _nt_step_keyword
1370
- if r5
1371
- r4 = nil
1372
- else
1373
- self.index = i4
1374
- r4 = instantiate_node(SyntaxNode,input, index...index)
1375
- end
1376
- s3 << r4
1377
- if r4
1378
- i6 = index
1379
- r7 = _nt_scenario_keyword
1380
- if r7
1381
- r6 = nil
1382
- else
1383
- self.index = i6
1384
- r6 = instantiate_node(SyntaxNode,input, index...index)
1385
- end
1386
- s3 << r6
1361
+ s0, i0 = [], index
1362
+ loop do
1363
+ i1, s1 = index, []
1364
+ i2 = index
1365
+ i3, s3 = index, []
1366
+ r4 = _nt_eol
1367
+ s3 << r4
1368
+ if r4
1369
+ s5, i5 = [], index
1370
+ loop do
1371
+ r6 = _nt_space
1387
1372
  if r6
1388
- i8 = index
1389
- r9 = _nt_scenario_outline_keyword
1390
- if r9
1391
- r8 = nil
1392
- else
1393
- self.index = i8
1394
- r8 = instantiate_node(SyntaxNode,input, index...index)
1395
- end
1396
- s3 << r8
1397
- if r8
1398
- i10 = index
1399
- r11 = _nt_table
1400
- if r11
1401
- r10 = nil
1402
- else
1403
- self.index = i10
1404
- r10 = instantiate_node(SyntaxNode,input, index...index)
1405
- end
1406
- s3 << r10
1407
- if r10
1408
- i12 = index
1409
- r13 = _nt_tag
1410
- if r13
1411
- r12 = nil
1412
- else
1413
- self.index = i12
1414
- r12 = instantiate_node(SyntaxNode,input, index...index)
1415
- end
1416
- s3 << r12
1417
- if r12
1418
- i14 = index
1419
- r15 = _nt_comment_line
1420
- if r15
1421
- r14 = nil
1422
- else
1423
- self.index = i14
1424
- r14 = instantiate_node(SyntaxNode,input, index...index)
1425
- end
1426
- s3 << r14
1427
- if r14
1428
- i16 = index
1429
- r17 = _nt_eol
1430
- if r17
1431
- r16 = nil
1432
- else
1433
- self.index = i16
1434
- r16 = instantiate_node(SyntaxNode,input, index...index)
1435
- end
1436
- s3 << r16
1437
- if r16
1438
- if index < input_length
1439
- r18 = instantiate_node(SyntaxNode,input, index...(index + 1))
1440
- @index += 1
1441
- else
1442
- terminal_parse_failure("any character")
1443
- r18 = nil
1444
- end
1445
- s3 << r18
1446
- end
1447
- end
1448
- end
1449
- end
1450
- end
1373
+ s5 << r6
1374
+ else
1375
+ break
1451
1376
  end
1452
1377
  end
1453
- if s3.last
1454
- r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
1455
- r3.extend(LineToKeyword0)
1456
- else
1457
- self.index = i3
1458
- r3 = nil
1378
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
1379
+ s3 << r5
1380
+ if r5
1381
+ r7 = _nt_reserved_words_and_symbols
1382
+ s3 << r7
1459
1383
  end
1460
- if r3
1461
- s2 << r3
1384
+ end
1385
+ if s3.last
1386
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
1387
+ r3.extend(LinesToKeyword0)
1388
+ else
1389
+ self.index = i3
1390
+ r3 = nil
1391
+ end
1392
+ if r3
1393
+ r2 = nil
1394
+ else
1395
+ self.index = i2
1396
+ r2 = instantiate_node(SyntaxNode,input, index...index)
1397
+ end
1398
+ s1 << r2
1399
+ if r2
1400
+ if index < input_length
1401
+ r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
1402
+ @index += 1
1462
1403
  else
1463
- break
1404
+ terminal_parse_failure("any character")
1405
+ r8 = nil
1464
1406
  end
1407
+ s1 << r8
1465
1408
  end
1466
- if s2.empty?
1467
- self.index = i2
1468
- r2 = nil
1409
+ if s1.last
1410
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
1411
+ r1.extend(LinesToKeyword1)
1469
1412
  else
1470
- r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
1413
+ self.index = i1
1414
+ r1 = nil
1415
+ end
1416
+ if r1
1417
+ s0 << r1
1418
+ else
1419
+ break
1471
1420
  end
1472
- s0 << r2
1473
- end
1474
- if s0.last
1475
- r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1476
- r0.extend(LineToKeyword1)
1477
- r0.extend(LineToKeyword2)
1478
- else
1479
- self.index = i0
1480
- r0 = nil
1481
1421
  end
1422
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1423
+ r0.extend(LinesToKeyword2)
1482
1424
 
1483
- node_cache[:line_to_keyword][start_index] = r0
1425
+ node_cache[:lines_to_keyword][start_index] = r0
1484
1426
 
1485
1427
  return r0
1486
1428
  end
1487
1429
 
1488
- module LinesToKeyword0
1489
- def build
1490
- elements.map{|s| s.build}.join("\n")
1430
+ module ReservedWordsAndSymbols0
1431
+ def step_keyword
1432
+ elements[0]
1433
+ end
1434
+
1435
+ def keyword_space
1436
+ elements[1]
1491
1437
  end
1492
1438
  end
1493
1439
 
1494
- def _nt_lines_to_keyword
1440
+ def _nt_reserved_words_and_symbols
1495
1441
  start_index = index
1496
- if node_cache[:lines_to_keyword].has_key?(index)
1497
- cached = node_cache[:lines_to_keyword][index]
1442
+ if node_cache[:reserved_words_and_symbols].has_key?(index)
1443
+ cached = node_cache[:reserved_words_and_symbols][index]
1498
1444
  @index = cached.interval.end if cached
1499
1445
  return cached
1500
1446
  end
1501
1447
 
1502
- s0, i0 = [], index
1503
- loop do
1504
- r1 = _nt_line_to_keyword
1505
- if r1
1506
- s0 << r1
1448
+ i0 = index
1449
+ i1, s1 = index, []
1450
+ r2 = _nt_step_keyword
1451
+ s1 << r2
1452
+ if r2
1453
+ r3 = _nt_keyword_space
1454
+ s1 << r3
1455
+ end
1456
+ if s1.last
1457
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
1458
+ r1.extend(ReservedWordsAndSymbols0)
1459
+ else
1460
+ self.index = i1
1461
+ r1 = nil
1462
+ end
1463
+ if r1
1464
+ r0 = r1
1465
+ else
1466
+ r4 = _nt_scenario_keyword
1467
+ if r4
1468
+ r0 = r4
1507
1469
  else
1508
- break
1470
+ r5 = _nt_scenario_outline_keyword
1471
+ if r5
1472
+ r0 = r5
1473
+ else
1474
+ r6 = _nt_table
1475
+ if r6
1476
+ r0 = r6
1477
+ else
1478
+ r7 = _nt_tag
1479
+ if r7
1480
+ r0 = r7
1481
+ else
1482
+ r8 = _nt_comment_line
1483
+ if r8
1484
+ r0 = r8
1485
+ else
1486
+ self.index = i0
1487
+ r0 = nil
1488
+ end
1489
+ end
1490
+ end
1491
+ end
1509
1492
  end
1510
1493
  end
1511
- r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1512
- r0.extend(LinesToKeyword0)
1513
1494
 
1514
- node_cache[:lines_to_keyword][start_index] = r0
1495
+ node_cache[:reserved_words_and_symbols][start_index] = r0
1515
1496
 
1516
1497
  return r0
1517
1498
  end
@@ -273,22 +273,18 @@ module Cucumber
273
273
  (!eol .)*
274
274
  end
275
275
 
276
- rule line_to_keyword
277
- white text:(!step_keyword !scenario_keyword !scenario_outline_keyword !table !tag !comment_line !eol .)+ {
278
- def build
279
- text.text_value.strip
280
- end
281
- }
282
- end
283
-
284
276
  rule lines_to_keyword
285
- line_to_keyword* {
277
+ (!(eol space* reserved_words_and_symbols) .)* {
286
278
  def build
287
- elements.map{|s| s.build}.join("\n")
279
+ self.text_value.split("\n").map{|s| s.strip}.join("\n")
288
280
  end
289
281
  }
290
282
  end
291
283
 
284
+ rule reserved_words_and_symbols
285
+ (step_keyword keyword_space) / scenario_keyword / scenario_outline_keyword / table / tag / comment_line
286
+ end
287
+
292
288
  rule py_string
293
289
  open_py_string s:(!close_py_string .)* close_py_string {
294
290
  def at_line?(line)
@@ -2,7 +2,7 @@ module Cucumber #:nodoc:
2
2
  class VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- TINY = 4
5
+ TINY = 5
6
6
  PATCH = nil # Set to nil for official release
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PATCH].compact.join('.')
@@ -177,7 +177,7 @@ Given I have a string
177
177
 
178
178
  it "should allow multiline names" do
179
179
  parse(%{Feature: Hi
180
- Scenario: It is my ambition to say
180
+ Scenario: It is my ambition to say
181
181
  in ten sentences
182
182
  what others say
183
183
  in a whole book.
@@ -188,7 +188,18 @@ Given I am a step
188
188
  [:scenario, 2, "Scenario:", "It is my ambition to say\nin ten sentences\nwhat others say\nin a whole book.",
189
189
  [:step_invocation, 6, "Given", "I am a step"]]]
190
190
  end
191
-
191
+
192
+ it "should ignore gherkin keywords which are parts of other words in the name" do
193
+ parse(%{Feature: Parser bug
194
+ Scenario: I have a Button
195
+ Buttons are great
196
+ Given I have it
197
+ }).to_sexp.should ==
198
+ [:feature, nil, "Feature: Parser bug",
199
+ [:scenario, 2, "Scenario:", "I have a Button\nButtons are great",
200
+ [:step_invocation, 4, "Given", "I have it"]]]
201
+
202
+ end
192
203
  end
193
204
 
194
205
  describe "Scenario Outlines" do
@@ -306,16 +317,15 @@ Examples: I'm a multiline name
306
317
  end
307
318
 
308
319
  it "should allow Examples to have multiline names" do
309
- pending('https://rspec.lighthouseapp.com/projects/16211/tickets/307-031-step-mother-parses-scenario-titles') do
310
320
  parse(%{Feature: Hi
311
321
  Scenario: When I have when in scenario
322
+ I should be fine
312
323
  Given I am a step
313
324
  }).to_sexp.should ==
314
325
  [:feature, nil, "Feature: Hi",
315
- [:scenario, 2, "Scenario:", "When I have when in scenario",
316
- [:step_invocation, 3, "Given", "I am a step"]]]
326
+ [:scenario, 2, "Scenario:", "When I have when in scenario\nI should be fine",
327
+ [:step_invocation, 4, "Given", "I am a step"]]]
317
328
  end
318
- end
319
329
  end
320
330
 
321
331
  describe "Syntax" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aslakhellesoy-cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Aslak Helles\xC3\xB8y"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-14 00:00:00 -07:00
12
+ date: 2009-05-15 00:00:00 -07:00
13
13
  default_executable: cucumber
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency