cucumber 0.4.4 → 0.4.5.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. data/.gitignore +2 -1
  2. data/Caliper.yml +5 -0
  3. data/History.txt +24 -1
  4. data/Rakefile +1 -1
  5. data/VERSION.yml +2 -2
  6. data/cucumber.gemspec +18 -27
  7. data/cucumber.yml +10 -4
  8. data/examples/i18n/README.textile +1 -1
  9. data/examples/i18n/bg/features/consecutive_calculations.feature +1 -1
  10. data/examples/i18n/bg/features/division.feature +1 -1
  11. data/examples/i18n/en-lol/Rakefile +1 -3
  12. data/examples/i18n/en/features/division.feature +4 -4
  13. data/examples/i18n/et/features/jagamine.feature +1 -1
  14. data/examples/i18n/fr/features/addition2.feature +17 -0
  15. data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +13 -0
  16. data/examples/i18n/ja/features/step_definitons/calculator_steps.rb +3 -3
  17. data/examples/i18n/lt/features/addition.feature +2 -2
  18. data/examples/i18n/lt/features/division.feature +1 -1
  19. data/examples/i18n/zh-CN/Rakefile +1 -3
  20. data/examples/i18n/zh-TW/Rakefile +1 -3
  21. data/examples/tcl/README.textile +11 -0
  22. data/examples/tcl/Rakefile +6 -0
  23. data/examples/tcl/features/fibonnacci.feature +17 -0
  24. data/examples/tcl/features/step_definitions/fib_steps.rb +7 -0
  25. data/examples/tcl/features/support/env.rb +6 -0
  26. data/examples/tcl/src/fib.tcl +3 -0
  27. data/examples/tickets/features/177/1.feature +3 -4
  28. data/examples/tickets/features/177/2.feature +2 -3
  29. data/examples/tickets/features/241.feature +2 -3
  30. data/examples/tickets/features/301/filter_background_tagged_hooks.feature +1 -1
  31. data/features/cucumber_cli.feature +4 -2
  32. data/features/custom_formatter.feature +32 -31
  33. data/features/html_formatter/a.html +319 -102
  34. data/features/language_help.feature +12 -14
  35. data/features/support/env.rb +1 -1
  36. data/features/transform.feature +17 -3
  37. data/gem_tasks/features.rake +3 -1
  38. data/lib/cucumber/ast/scenario_outline.rb +1 -1
  39. data/lib/cucumber/ast/step_invocation.rb +2 -2
  40. data/lib/cucumber/cli/configuration.rb +2 -17
  41. data/lib/cucumber/cli/language_help_formatter.rb +1 -1
  42. data/lib/cucumber/cli/options.rb +5 -4
  43. data/lib/cucumber/formatter/cucumber.css +198 -82
  44. data/lib/cucumber/formatter/cucumber.sass +173 -71
  45. data/lib/cucumber/formatter/html.rb +371 -195
  46. data/lib/cucumber/formatter/io.rb +33 -0
  47. data/lib/cucumber/formatter/junit.rb +16 -7
  48. data/lib/cucumber/formatter/pdf.rb +5 -5
  49. data/lib/cucumber/formatter/pretty.rb +6 -8
  50. data/lib/cucumber/formatter/progress.rb +4 -2
  51. data/lib/cucumber/formatter/rerun.rb +4 -2
  52. data/lib/cucumber/formatter/steps.rb +2 -2
  53. data/lib/cucumber/formatter/tag_cloud.rb +6 -2
  54. data/lib/cucumber/formatter/usage.rb +2 -2
  55. data/lib/cucumber/languages.yml +205 -281
  56. data/lib/cucumber/parser/feature.rb +348 -82
  57. data/lib/cucumber/parser/feature.tt +47 -11
  58. data/lib/cucumber/parser/i18n.tt +7 -17
  59. data/lib/cucumber/parser/natural_language.rb +45 -18
  60. data/lib/cucumber/rb_support/rb_transform.rb +1 -1
  61. data/lib/cucumber/step_mother.rb +2 -3
  62. data/lib/cucumber/webrat/element_locator.rb +9 -5
  63. data/spec/cucumber/cli/options_spec.rb +0 -3
  64. data/spec/cucumber/formatter/html_spec.rb +15 -2
  65. data/spec/cucumber/formatter/junit_spec.rb +3 -0
  66. data/spec/cucumber/treetop_parser/fit_scenario.feature +2 -2
  67. data/spec/cucumber/treetop_parser/given_scenario.feature +1 -1
  68. data/spec/cucumber/treetop_parser/multiple_tables.feature +2 -2
  69. data/spec/cucumber/treetop_parser/test_dos.feature +1 -1
  70. metadata +17 -26
  71. data/Manifest.txt +0 -0
  72. data/lib/cucumber/rails/action_controller.rb +0 -38
  73. data/lib/cucumber/rails/active_record.rb +0 -30
  74. data/lib/cucumber/rails/rspec.rb +0 -10
  75. data/lib/cucumber/rails/test_unit.rb +0 -9
  76. data/lib/cucumber/rails/world.rb +0 -30
  77. data/rails_generators/cucumber/USAGE +0 -11
  78. data/rails_generators/cucumber/cucumber_generator.rb +0 -117
  79. data/rails_generators/cucumber/templates/cucumber +0 -17
  80. data/rails_generators/cucumber/templates/cucumber.rake +0 -46
  81. data/rails_generators/cucumber/templates/cucumber_environment.rb +0 -30
  82. data/rails_generators/cucumber/templates/env.rb +0 -49
  83. data/rails_generators/cucumber/templates/paths.rb +0 -27
  84. data/rails_generators/cucumber/templates/spork_env.rb +0 -57
  85. data/rails_generators/cucumber/templates/version_check.rb +0 -31
  86. data/rails_generators/cucumber/templates/webrat_steps.rb +0 -241
  87. data/rails_generators/feature/USAGE +0 -12
  88. data/rails_generators/feature/feature_generator.rb +0 -40
  89. data/rails_generators/feature/templates/feature.erb +0 -31
  90. data/rails_generators/feature/templates/steps.erb +0 -14
@@ -491,8 +491,8 @@ module Cucumber
491
491
  steps.at_line?(line)
492
492
  end
493
493
 
494
- def matches_tags?(tag_name_lists)
495
- Ast::Tags.matches?(self.parent.tags.tag_names, tag_name_lists)
494
+ def matches_tags?(tag_names)
495
+ Ast::Tags.matches?(self.parent.tags.tag_names, tag_names)
496
496
  end
497
497
 
498
498
  def build
@@ -687,10 +687,10 @@ module Cucumber
687
687
  tags.at_line?(line)
688
688
  end
689
689
 
690
- def matches_tags?(tag_name_lists)
690
+ def matches_tags?(tag_names)
691
691
  feature_tag_names = self.parent.parent.tags.tag_names
692
692
  source_tag_names = (feature_tag_names + tags.tag_names).uniq
693
- Ast::Tags.matches?(source_tag_names, tag_name_lists)
693
+ Ast::Tags.matches?(source_tag_names, tag_names)
694
694
  end
695
695
 
696
696
  def matches_name?(regexp_to_match)
@@ -826,10 +826,10 @@ module Cucumber
826
826
  steps.at_line?(line)
827
827
  end
828
828
 
829
- def matches_tags?(tag_name_lists)
829
+ def matches_tags?(tag_names)
830
830
  feature_tag_names = self.parent.parent.tags.tag_names
831
831
  source_tag_names = (feature_tag_names + tags.tag_names).uniq
832
- Ast::Tags.matches?(source_tag_names, tag_name_lists)
832
+ Ast::Tags.matches?(source_tag_names, tag_names)
833
833
  end
834
834
 
835
835
  def matches_name?(regexp_to_match)
@@ -968,10 +968,6 @@ module Cucumber
968
968
  elements[2]
969
969
  end
970
970
 
971
- def keyword_space
972
- elements[3]
973
- end
974
-
975
971
  def name
976
972
  elements[4]
977
973
  end
@@ -993,9 +989,9 @@ module Cucumber
993
989
 
994
990
  def build
995
991
  if multi.respond_to?(:build)
996
- Ast::Step.new(step_keyword.line, step_keyword.text_value, name.text_value.strip, multi.build)
992
+ Ast::Step.new(step_keyword.line, step_keyword.text_value.strip, name.text_value.strip, multi.build)
997
993
  else
998
- Ast::Step.new(step_keyword.line, step_keyword.text_value, name.text_value.strip)
994
+ Ast::Step.new(step_keyword.line, step_keyword.text_value.strip, name.text_value.strip)
999
995
  end
1000
996
  end
1001
997
  end
@@ -1027,51 +1023,60 @@ module Cucumber
1027
1023
  r4 = _nt_step_keyword
1028
1024
  s0 << r4
1029
1025
  if r4
1030
- r5 = _nt_keyword_space
1026
+ s5, i5 = [], index
1027
+ loop do
1028
+ r6 = _nt_space
1029
+ if r6
1030
+ s5 << r6
1031
+ else
1032
+ break
1033
+ end
1034
+ end
1035
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
1031
1036
  s0 << r5
1032
1037
  if r5
1033
- r6 = _nt_line_to_eol
1034
- s0 << r6
1035
- if r6
1036
- i7 = index
1037
- s8, i8 = [], index
1038
+ r7 = _nt_line_to_eol
1039
+ s0 << r7
1040
+ if r7
1041
+ i8 = index
1042
+ s9, i9 = [], index
1038
1043
  loop do
1039
- r9 = _nt_eol
1040
- if r9
1041
- s8 << r9
1044
+ r10 = _nt_eol
1045
+ if r10
1046
+ s9 << r10
1042
1047
  else
1043
1048
  break
1044
1049
  end
1045
1050
  end
1046
- if s8.empty?
1047
- @index = i8
1048
- r8 = nil
1051
+ if s9.empty?
1052
+ @index = i9
1053
+ r9 = nil
1049
1054
  else
1050
- r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
1055
+ r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
1051
1056
  end
1052
- if r8
1053
- r7 = r8
1057
+ if r9
1058
+ r8 = r9
1054
1059
  else
1055
- r10 = _nt_eof
1056
- if r10
1057
- r7 = r10
1060
+ r11 = _nt_eof
1061
+ if r11
1062
+ r8 = r11
1058
1063
  else
1059
- @index = i7
1060
- r7 = nil
1064
+ @index = i8
1065
+ r8 = nil
1061
1066
  end
1062
1067
  end
1063
- s0 << r7
1064
- if r7
1065
- r12 = _nt_multiline_arg
1066
- if r12
1067
- r11 = r12
1068
+ s0 << r8
1069
+ if r8
1070
+ r13 = _nt_multiline_arg
1071
+ if r13
1072
+ r12 = r13
1068
1073
  else
1069
- r11 = instantiate_node(SyntaxNode,input, index...index)
1074
+ r12 = instantiate_node(SyntaxNode,input, index...index)
1070
1075
  end
1071
- s0 << r11
1072
- if r11
1073
- r13 = _nt_white
1074
- s0 << r13
1076
+ s0 << r12
1077
+ if r12
1078
+ r14 = _nt_white
1079
+ s0 << r14
1075
1080
  end
1076
1081
  end
1077
1082
  end
@@ -1168,7 +1173,7 @@ module Cucumber
1168
1173
  table.at_line?(line)
1169
1174
  end
1170
1175
 
1171
- def matches_tags?(tag_name_lists)
1176
+ def matches_tags?(tag_names)
1172
1177
  true
1173
1178
  end
1174
1179
 
@@ -1437,16 +1442,6 @@ module Cucumber
1437
1442
  r0
1438
1443
  end
1439
1444
 
1440
- module ReservedWordsAndSymbols0
1441
- def step_keyword
1442
- elements[0]
1443
- end
1444
-
1445
- def keyword_space
1446
- elements[1]
1447
- end
1448
- end
1449
-
1450
1445
  def _nt_reserved_words_and_symbols
1451
1446
  start_index = index
1452
1447
  if node_cache[:reserved_words_and_symbols].has_key?(index)
@@ -1456,42 +1451,29 @@ module Cucumber
1456
1451
  end
1457
1452
 
1458
1453
  i0 = index
1459
- i1, s1 = index, []
1460
- r2 = _nt_step_keyword
1461
- s1 << r2
1462
- if r2
1463
- r3 = _nt_keyword_space
1464
- s1 << r3
1465
- end
1466
- if s1.last
1467
- r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
1468
- r1.extend(ReservedWordsAndSymbols0)
1469
- else
1470
- @index = i1
1471
- r1 = nil
1472
- end
1454
+ r1 = _nt_step_keyword
1473
1455
  if r1
1474
1456
  r0 = r1
1475
1457
  else
1476
- r4 = _nt_scenario_keyword
1477
- if r4
1478
- r0 = r4
1458
+ r2 = _nt_scenario_keyword
1459
+ if r2
1460
+ r0 = r2
1479
1461
  else
1480
- r5 = _nt_scenario_outline_keyword
1481
- if r5
1482
- r0 = r5
1462
+ r3 = _nt_scenario_outline_keyword
1463
+ if r3
1464
+ r0 = r3
1483
1465
  else
1484
- r6 = _nt_table
1485
- if r6
1486
- r0 = r6
1466
+ r4 = _nt_table
1467
+ if r4
1468
+ r0 = r4
1487
1469
  else
1488
- r7 = _nt_tag
1489
- if r7
1490
- r0 = r7
1470
+ r5 = _nt_tag
1471
+ if r5
1472
+ r0 = r5
1491
1473
  else
1492
- r8 = _nt_comment_line
1493
- if r8
1494
- r0 = r8
1474
+ r6 = _nt_comment_line
1475
+ if r6
1476
+ r0 = r6
1495
1477
  else
1496
1478
  @index = i0
1497
1479
  r0 = nil
@@ -1507,6 +1489,290 @@ module Cucumber
1507
1489
  r0
1508
1490
  end
1509
1491
 
1492
+ module PyString0
1493
+ end
1494
+
1495
+ module PyString1
1496
+ def open_py_string
1497
+ elements[0]
1498
+ end
1499
+
1500
+ def s
1501
+ elements[1]
1502
+ end
1503
+
1504
+ def close_py_string
1505
+ elements[2]
1506
+ end
1507
+ end
1508
+
1509
+ module PyString2
1510
+ def at_line?(line)
1511
+ line >= open_py_string.line && line <= close_py_string.line
1512
+ end
1513
+
1514
+ def build
1515
+ Ast::PyString.new(open_py_string.line, close_py_string.line, s.text_value, open_py_string.indentation)
1516
+ end
1517
+ end
1518
+
1519
+ def _nt_py_string
1520
+ start_index = index
1521
+ if node_cache[:py_string].has_key?(index)
1522
+ cached = node_cache[:py_string][index]
1523
+ @index = cached.interval.end if cached
1524
+ return cached
1525
+ end
1526
+
1527
+ i0, s0 = index, []
1528
+ r1 = _nt_open_py_string
1529
+ s0 << r1
1530
+ if r1
1531
+ s2, i2 = [], index
1532
+ loop do
1533
+ i3, s3 = index, []
1534
+ i4 = index
1535
+ r5 = _nt_close_py_string
1536
+ if r5
1537
+ r4 = nil
1538
+ else
1539
+ @index = i4
1540
+ r4 = instantiate_node(SyntaxNode,input, index...index)
1541
+ end
1542
+ s3 << r4
1543
+ if r4
1544
+ if index < input_length
1545
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
1546
+ @index += 1
1547
+ else
1548
+ terminal_parse_failure("any character")
1549
+ r6 = nil
1550
+ end
1551
+ s3 << r6
1552
+ end
1553
+ if s3.last
1554
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
1555
+ r3.extend(PyString0)
1556
+ else
1557
+ @index = i3
1558
+ r3 = nil
1559
+ end
1560
+ if r3
1561
+ s2 << r3
1562
+ else
1563
+ break
1564
+ end
1565
+ end
1566
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
1567
+ s0 << r2
1568
+ if r2
1569
+ r7 = _nt_close_py_string
1570
+ s0 << r7
1571
+ end
1572
+ end
1573
+ if s0.last
1574
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1575
+ r0.extend(PyString1)
1576
+ r0.extend(PyString2)
1577
+ else
1578
+ @index = i0
1579
+ r0 = nil
1580
+ end
1581
+
1582
+ node_cache[:py_string][start_index] = r0
1583
+
1584
+ r0
1585
+ end
1586
+
1587
+ module OpenPyString0
1588
+ def indent
1589
+ elements[0]
1590
+ end
1591
+
1592
+ def eol
1593
+ elements[3]
1594
+ end
1595
+ end
1596
+
1597
+ module OpenPyString1
1598
+ def indentation
1599
+ indent.text_value.length
1600
+ end
1601
+
1602
+ def line
1603
+ indent.line
1604
+ end
1605
+ end
1606
+
1607
+ def _nt_open_py_string
1608
+ start_index = index
1609
+ if node_cache[:open_py_string].has_key?(index)
1610
+ cached = node_cache[:open_py_string][index]
1611
+ @index = cached.interval.end if cached
1612
+ return cached
1613
+ end
1614
+
1615
+ i0, s0 = index, []
1616
+ s1, i1 = [], index
1617
+ loop do
1618
+ r2 = _nt_space
1619
+ if r2
1620
+ s1 << r2
1621
+ else
1622
+ break
1623
+ end
1624
+ end
1625
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
1626
+ s0 << r1
1627
+ if r1
1628
+ if has_terminal?('"""', false, index)
1629
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 3))
1630
+ @index += 3
1631
+ else
1632
+ terminal_parse_failure('"""')
1633
+ r3 = nil
1634
+ end
1635
+ s0 << r3
1636
+ if r3
1637
+ s4, i4 = [], index
1638
+ loop do
1639
+ r5 = _nt_space
1640
+ if r5
1641
+ s4 << r5
1642
+ else
1643
+ break
1644
+ end
1645
+ end
1646
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
1647
+ s0 << r4
1648
+ if r4
1649
+ r6 = _nt_eol
1650
+ s0 << r6
1651
+ end
1652
+ end
1653
+ end
1654
+ if s0.last
1655
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1656
+ r0.extend(OpenPyString0)
1657
+ r0.extend(OpenPyString1)
1658
+ else
1659
+ @index = i0
1660
+ r0 = nil
1661
+ end
1662
+
1663
+ node_cache[:open_py_string][start_index] = r0
1664
+
1665
+ r0
1666
+ end
1667
+
1668
+ module ClosePyString0
1669
+ def eol
1670
+ elements[0]
1671
+ end
1672
+
1673
+ def quotes
1674
+ elements[2]
1675
+ end
1676
+
1677
+ def white
1678
+ elements[3]
1679
+ end
1680
+ end
1681
+
1682
+ module ClosePyString1
1683
+ def line
1684
+ quotes.line
1685
+ end
1686
+ end
1687
+
1688
+ def _nt_close_py_string
1689
+ start_index = index
1690
+ if node_cache[:close_py_string].has_key?(index)
1691
+ cached = node_cache[:close_py_string][index]
1692
+ @index = cached.interval.end if cached
1693
+ return cached
1694
+ end
1695
+
1696
+ i0, s0 = index, []
1697
+ r1 = _nt_eol
1698
+ s0 << r1
1699
+ if r1
1700
+ s2, i2 = [], index
1701
+ loop do
1702
+ r3 = _nt_space
1703
+ if r3
1704
+ s2 << r3
1705
+ else
1706
+ break
1707
+ end
1708
+ end
1709
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
1710
+ s0 << r2
1711
+ if r2
1712
+ if has_terminal?('"""', false, index)
1713
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 3))
1714
+ @index += 3
1715
+ else
1716
+ terminal_parse_failure('"""')
1717
+ r4 = nil
1718
+ end
1719
+ s0 << r4
1720
+ if r4
1721
+ r5 = _nt_white
1722
+ s0 << r5
1723
+ end
1724
+ end
1725
+ end
1726
+ if s0.last
1727
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1728
+ r0.extend(ClosePyString0)
1729
+ r0.extend(ClosePyString1)
1730
+ else
1731
+ @index = i0
1732
+ r0 = nil
1733
+ end
1734
+
1735
+ node_cache[:close_py_string][start_index] = r0
1736
+
1737
+ r0
1738
+ end
1739
+
1740
+ def _nt_white
1741
+ start_index = index
1742
+ if node_cache[:white].has_key?(index)
1743
+ cached = node_cache[:white][index]
1744
+ @index = cached.interval.end if cached
1745
+ return cached
1746
+ end
1747
+
1748
+ s0, i0 = [], index
1749
+ loop do
1750
+ i1 = index
1751
+ r2 = _nt_space
1752
+ if r2
1753
+ r1 = r2
1754
+ else
1755
+ r3 = _nt_eol
1756
+ if r3
1757
+ r1 = r3
1758
+ else
1759
+ @index = i1
1760
+ r1 = nil
1761
+ end
1762
+ end
1763
+ if r1
1764
+ s0 << r1
1765
+ else
1766
+ break
1767
+ end
1768
+ end
1769
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1770
+
1771
+ node_cache[:white][start_index] = r0
1772
+
1773
+ r0
1774
+ end
1775
+
1510
1776
  end
1511
1777
 
1512
1778
  class FeatureParser < Treetop::Runtime::CompiledParser