cucumber-cucumber-expressions 10.1.0 → 11.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/.rsync +1 -0
  3. data/VERSION +1 -0
  4. data/cucumber-cucumber-expressions.gemspec +5 -2
  5. data/default.mk +13 -6
  6. data/examples.txt +13 -1
  7. data/lib/cucumber/cucumber_expressions/ast.rb +201 -0
  8. data/lib/cucumber/cucumber_expressions/cucumber_expression.rb +80 -76
  9. data/lib/cucumber/cucumber_expressions/cucumber_expression_generator.rb +4 -8
  10. data/lib/cucumber/cucumber_expressions/cucumber_expression_parser.rb +219 -0
  11. data/lib/cucumber/cucumber_expressions/cucumber_expression_tokenizer.rb +95 -0
  12. data/lib/cucumber/cucumber_expressions/errors.rb +175 -4
  13. data/lib/cucumber/cucumber_expressions/group.rb +1 -1
  14. data/lib/cucumber/cucumber_expressions/parameter_type.rb +12 -7
  15. data/lib/cucumber/cucumber_expressions/parameter_type_matcher.rb +2 -2
  16. data/lib/cucumber/cucumber_expressions/parameter_type_registry.rb +1 -1
  17. data/lib/cucumber/cucumber_expressions/tree_regexp.rb +53 -46
  18. data/spec/cucumber/cucumber_expressions/cucumber_expression_parser_spec.rb +24 -0
  19. data/spec/cucumber/cucumber_expressions/cucumber_expression_spec.rb +73 -124
  20. data/spec/cucumber/cucumber_expressions/cucumber_expression_tokenizer_spec.rb +24 -0
  21. data/spec/cucumber/cucumber_expressions/custom_parameter_type_spec.rb +1 -1
  22. data/spec/cucumber/cucumber_expressions/expression_examples_spec.rb +1 -1
  23. data/spec/cucumber/cucumber_expressions/expression_factory_spec.rb +0 -4
  24. data/spec/cucumber/cucumber_expressions/tree_regexp_spec.rb +58 -5
  25. data/testdata/ast/alternation-followed-by-optional.yaml +17 -0
  26. data/testdata/ast/alternation-phrase.yaml +16 -0
  27. data/testdata/ast/alternation-with-parameter.yaml +27 -0
  28. data/testdata/ast/alternation-with-unused-end-optional.yaml +15 -0
  29. data/testdata/ast/alternation-with-unused-start-optional.yaml +8 -0
  30. data/testdata/ast/alternation-with-white-space.yaml +12 -0
  31. data/testdata/ast/alternation.yaml +12 -0
  32. data/testdata/ast/anonymous-parameter.yaml +5 -0
  33. data/testdata/ast/closing-brace.yaml +5 -0
  34. data/testdata/ast/closing-parenthesis.yaml +5 -0
  35. data/testdata/ast/empty-alternation.yaml +8 -0
  36. data/testdata/ast/empty-alternations.yaml +9 -0
  37. data/testdata/ast/empty-string.yaml +3 -0
  38. data/testdata/ast/escaped-alternation.yaml +5 -0
  39. data/testdata/ast/escaped-backslash.yaml +5 -0
  40. data/testdata/ast/escaped-opening-parenthesis.yaml +5 -0
  41. data/testdata/ast/escaped-optional-followed-by-optional.yaml +15 -0
  42. data/testdata/ast/escaped-optional-phrase.yaml +10 -0
  43. data/testdata/ast/escaped-optional.yaml +7 -0
  44. data/testdata/ast/opening-brace.yaml +8 -0
  45. data/testdata/ast/opening-parenthesis.yaml +8 -0
  46. data/testdata/ast/optional-containing-nested-optional.yaml +15 -0
  47. data/testdata/ast/optional-phrase.yaml +12 -0
  48. data/testdata/ast/optional.yaml +7 -0
  49. data/testdata/ast/parameter.yaml +7 -0
  50. data/testdata/ast/phrase.yaml +9 -0
  51. data/testdata/ast/unfinished-parameter.yaml +8 -0
  52. data/testdata/expression/allows-escaped-optional-parameter-types.yaml +4 -0
  53. data/testdata/expression/allows-parameter-type-in-alternation-1.yaml +4 -0
  54. data/testdata/expression/allows-parameter-type-in-alternation-2.yaml +4 -0
  55. data/testdata/expression/does-allow-parameter-adjacent-to-alternation.yaml +5 -0
  56. data/testdata/expression/does-not-allow-alternation-in-optional.yaml +9 -0
  57. data/testdata/expression/does-not-allow-alternation-with-empty-alternative-by-adjacent-left-parameter.yaml +10 -0
  58. data/testdata/expression/does-not-allow-alternation-with-empty-alternative-by-adjacent-optional.yaml +9 -0
  59. data/testdata/expression/does-not-allow-alternation-with-empty-alternative-by-adjacent-right-parameter.yaml +9 -0
  60. data/testdata/expression/does-not-allow-alternation-with-empty-alternative.yaml +9 -0
  61. data/testdata/expression/does-not-allow-empty-optional.yaml +9 -0
  62. data/testdata/expression/does-not-allow-nested-optional.yaml +8 -0
  63. data/testdata/expression/does-not-allow-optional-parameter-types.yaml +9 -0
  64. data/testdata/expression/does-not-allow-parameter-name-with-reserved-characters.yaml +10 -0
  65. data/testdata/expression/does-not-allow-unfinished-parenthesis-1.yaml +8 -0
  66. data/testdata/expression/does-not-allow-unfinished-parenthesis-2.yaml +8 -0
  67. data/testdata/expression/does-not-allow-unfinished-parenthesis-3.yaml +8 -0
  68. data/testdata/expression/does-not-match-misquoted-string.yaml +4 -0
  69. data/testdata/expression/doesnt-match-float-as-int.yaml +5 -0
  70. data/testdata/expression/matches-alternation.yaml +4 -0
  71. data/testdata/expression/matches-anonymous-parameter-type.yaml +5 -0
  72. data/testdata/expression/matches-double-quoted-empty-string-as-empty-string-along-with-other-strings.yaml +4 -0
  73. data/testdata/expression/matches-double-quoted-empty-string-as-empty-string.yaml +4 -0
  74. data/testdata/expression/matches-double-quoted-string-with-escaped-double-quote.yaml +4 -0
  75. data/testdata/expression/matches-double-quoted-string-with-single-quotes.yaml +4 -0
  76. data/testdata/expression/matches-double-quoted-string.yaml +4 -0
  77. data/testdata/expression/matches-doubly-escaped-parenthesis.yaml +4 -0
  78. data/testdata/expression/matches-doubly-escaped-slash-1.yaml +4 -0
  79. data/testdata/expression/matches-doubly-escaped-slash-2.yaml +4 -0
  80. data/testdata/expression/matches-escaped-parenthesis-1.yaml +4 -0
  81. data/testdata/expression/matches-escaped-parenthesis-2.yaml +4 -0
  82. data/testdata/expression/matches-escaped-parenthesis-3.yaml +4 -0
  83. data/testdata/expression/matches-escaped-slash.yaml +4 -0
  84. data/testdata/expression/matches-float-1.yaml +5 -0
  85. data/testdata/expression/matches-float-2.yaml +5 -0
  86. data/testdata/expression/matches-int.yaml +5 -0
  87. data/testdata/expression/matches-multiple-double-quoted-strings.yaml +4 -0
  88. data/testdata/expression/matches-multiple-single-quoted-strings.yaml +4 -0
  89. data/testdata/expression/matches-optional-before-alternation-1.yaml +4 -0
  90. data/testdata/expression/matches-optional-before-alternation-2.yaml +4 -0
  91. data/testdata/expression/matches-optional-before-alternation-with-regex-characters-1.yaml +4 -0
  92. data/testdata/expression/matches-optional-before-alternation-with-regex-characters-2.yaml +4 -0
  93. data/testdata/expression/matches-optional-in-alternation-1.yaml +5 -0
  94. data/testdata/expression/matches-optional-in-alternation-2.yaml +5 -0
  95. data/testdata/expression/matches-optional-in-alternation-3.yaml +5 -0
  96. data/testdata/expression/matches-single-quoted-empty-string-as-empty-string-along-with-other-strings.yaml +4 -0
  97. data/testdata/expression/matches-single-quoted-empty-string-as-empty-string.yaml +4 -0
  98. data/testdata/expression/matches-single-quoted-string-with-double-quotes.yaml +4 -0
  99. data/testdata/expression/matches-single-quoted-string-with-escaped-single-quote.yaml +4 -0
  100. data/testdata/expression/matches-single-quoted-string.yaml +4 -0
  101. data/testdata/expression/matches-word.yaml +4 -0
  102. data/testdata/expression/throws-unknown-parameter-type.yaml +10 -0
  103. data/testdata/regex/alternation-with-optional.yaml +2 -0
  104. data/testdata/regex/alternation.yaml +2 -0
  105. data/testdata/regex/empty.yaml +2 -0
  106. data/testdata/regex/escape-regex-characters.yaml +2 -0
  107. data/testdata/regex/optional.yaml +2 -0
  108. data/testdata/regex/parameter.yaml +2 -0
  109. data/testdata/regex/text.yaml +2 -0
  110. data/testdata/regex/unicode.yaml +2 -0
  111. data/testdata/tokens/alternation-phrase.yaml +13 -0
  112. data/testdata/tokens/alternation.yaml +9 -0
  113. data/testdata/tokens/empty-string.yaml +6 -0
  114. data/testdata/tokens/escape-non-reserved-character.yaml +8 -0
  115. data/testdata/tokens/escaped-alternation.yaml +9 -0
  116. data/testdata/tokens/escaped-char-has-start-index-of-text-token.yaml +9 -0
  117. data/testdata/tokens/escaped-end-of-line.yaml +8 -0
  118. data/testdata/tokens/escaped-optional.yaml +7 -0
  119. data/testdata/tokens/escaped-parameter.yaml +7 -0
  120. data/testdata/tokens/escaped-space.yaml +7 -0
  121. data/testdata/tokens/optional-phrase.yaml +13 -0
  122. data/testdata/tokens/optional.yaml +9 -0
  123. data/testdata/tokens/parameter-phrase.yaml +13 -0
  124. data/testdata/tokens/parameter.yaml +9 -0
  125. data/testdata/tokens/phrase.yaml +11 -0
  126. metadata +117 -11
  127. data/spec/cucumber/cucumber_expressions/cucumber_expression_regexp_spec.rb +0 -57
@@ -0,0 +1,24 @@
1
+ require 'yaml'
2
+ require 'json'
3
+ require 'cucumber/cucumber_expressions/cucumber_expression_tokenizer'
4
+ require 'cucumber/cucumber_expressions/errors'
5
+
6
+ module Cucumber
7
+ module CucumberExpressions
8
+ describe 'Cucumber expression tokenizer' do
9
+ Dir['testdata/tokens/*.yaml'].each do |testcase|
10
+ expectation = YAML.load_file(testcase) # encoding?
11
+ it "#{testcase}" do
12
+ tokenizer = CucumberExpressionTokenizer.new
13
+ if expectation['exception'].nil?
14
+ tokens = tokenizer.tokenize(expectation['expression'])
15
+ token_hashes = tokens.map{|token| token.to_hash}
16
+ expect(token_hashes).to eq(JSON.parse(expectation['expected']))
17
+ else
18
+ expect { tokenizer.tokenize(expectation['expression']) }.to raise_error(expectation['exception'])
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -69,7 +69,7 @@ module Cucumber
69
69
  true,
70
70
  false
71
71
  )
72
- end.to raise_error("Illegal character '[' in parameter name {[string]}")
72
+ end.to raise_error("Illegal character in parameter name {[string]}. Parameter names may not contain '[]()$.|?*+'")
73
73
  end
74
74
 
75
75
  describe CucumberExpression do
@@ -7,7 +7,7 @@ module Cucumber
7
7
  module CucumberExpressions
8
8
  describe 'examples.txt' do
9
9
  def match(expression_text, text)
10
- expression = expression_text =~ /\/(.*)\// ?
10
+ expression = expression_text =~ /^\/(.*)\/$/ ?
11
11
  RegularExpression.new(Regexp.new($1), ParameterTypeRegistry.new) :
12
12
  CucumberExpression.new(expression_text, ParameterTypeRegistry.new)
13
13
 
@@ -14,10 +14,6 @@ module Cucumber
14
14
  it 'creates a CucumberExpression' do
15
15
  expect(@expression_factory.create_expression('{int}').class).to eq(CucumberExpression)
16
16
  end
17
-
18
- it 'creates a XXXRegularExpression' do
19
- expect {@expression_factory.create_expression('hello {x}')}.to raise_error("Undefined parameter type {x}")
20
- end
21
17
  end
22
18
  end
23
19
  end
@@ -22,6 +22,7 @@ module Cucumber
22
22
  group = tr.match('abc')
23
23
  expect(group.value).to eq('abc')
24
24
  expect(group.children.length).to eq 1
25
+ expect(group.children[0].value).to eq('c')
25
26
  end
26
27
 
27
28
  it 'ignores `?!` as a non-capturing group' do
@@ -55,6 +56,28 @@ module Cucumber
55
56
  expect(group.children.length).to eq 1
56
57
  end
57
58
 
59
+ it 'ignores `?<!` as a non-capturing group' do
60
+ tr = TreeRegexp.new(/a(.+)(?<!b)$/)
61
+ group = tr.match('abc')
62
+ expect(group.value).to eq('abc')
63
+ expect(group.children[0].value).to eq('bc')
64
+ expect(group.children.length).to eq 1
65
+ end
66
+
67
+ it 'ignores `?>` as a non-capturing group' do
68
+ tr = TreeRegexp.new(/a(?>b)c/)
69
+ group = tr.match('abc')
70
+ expect(group.value).to eq('abc')
71
+ expect(group.children.length).to eq 0
72
+ end
73
+
74
+ it 'throws an error when there are named capture groups because they are buggy in Ruby' do
75
+ # https://github.com/cucumber/cucumber/issues/329
76
+ expect {
77
+ TreeRegexp.new(/^I am a person( named "(?<first_name>.+) (?<last_name>.+)")?$/)
78
+ }.to raise_error(/Named capture groups are not supported/)
79
+ end
80
+
58
81
  it 'matches optional group' do
59
82
  tr = TreeRegexp.new(/^Something( with an optional argument)?/)
60
83
  group = tr.match('Something')
@@ -122,12 +145,42 @@ module Cucumber
122
145
  expect(group.children.length).to eq(1)
123
146
  end
124
147
 
125
- it 'throws an error when there are named capture groups because they are buggy in Ruby' do
126
- # https://github.com/cucumber/cucumber/issues/329
127
- expect {
128
- TreeRegexp.new(/^I am a person( named "(?<first_name>.+) (?<last_name>.+)")?$/)
129
- }.to raise_error(/Named capture groups are not supported/)
148
+ it 'works with inline flags' do
149
+ tr = TreeRegexp.new(/(?i)HELLO/)
150
+ group = tr.match('hello')
151
+ expect(group.value).to eq('hello')
152
+ expect(group.children.length).to eq 0
153
+ end
154
+
155
+ it 'works with non capturing inline flags' do
156
+ tr = TreeRegexp.new(/(?i:HELLO)/)
157
+ group = tr.match('hello')
158
+ expect(group.value).to eq('hello')
159
+ expect(group.children.length).to eq 0
130
160
  end
161
+
162
+ it 'works with empty capturing group' do
163
+ tr = TreeRegexp.new(/()/)
164
+ group = tr.match('')
165
+ expect(group.value).to eq('')
166
+ expect(group.children[0].value).to eq('')
167
+ expect(group.children.length).to eq 1
168
+ end
169
+
170
+ it 'works with empty non-capturing group' do
171
+ tr = TreeRegexp.new(/(?:)/)
172
+ group = tr.match('')
173
+ expect(group.value).to eq('')
174
+ expect(group.children.length).to eq 0
175
+ end
176
+
177
+ it 'works with empty non-look ahead' do
178
+ tr = TreeRegexp.new(/(?<=)/)
179
+ group = tr.match('')
180
+ expect(group.value).to eq('')
181
+ expect(group.children.length).to eq 0
182
+ end
183
+
131
184
  end
132
185
  end
133
186
  end
@@ -0,0 +1,17 @@
1
+ expression: three blind\ rat/cat(s)
2
+ expected: |-
3
+ {"type": "EXPRESSION_NODE", "start": 0, "end": 23, "nodes": [
4
+ {"type": "TEXT_NODE", "start": 0, "end": 5, "token": "three"},
5
+ {"type": "TEXT_NODE", "start": 5, "end": 6, "token": " "},
6
+ {"type": "ALTERNATION_NODE", "start": 6, "end": 23, "nodes": [
7
+ {"type": "ALTERNATIVE_NODE", "start": 6, "end": 16, "nodes": [
8
+ {"type": "TEXT_NODE", "start": 6, "end": 16, "token": "blind rat"}
9
+ ]},
10
+ {"type": "ALTERNATIVE_NODE", "start": 17, "end": 23, "nodes": [
11
+ {"type": "TEXT_NODE", "start": 17, "end": 20, "token": "cat"},
12
+ {"type": "OPTIONAL_NODE", "start": 20, "end": 23, "nodes": [
13
+ {"type": "TEXT_NODE", "start": 21, "end": 22, "token": "s"}
14
+ ]}
15
+ ]}
16
+ ]}
17
+ ]}
@@ -0,0 +1,16 @@
1
+ expression: three hungry/blind mice
2
+ expected: |-
3
+ {"type": "EXPRESSION_NODE", "start": 0, "end": 23, "nodes": [
4
+ {"type": "TEXT_NODE", "start": 0, "end": 5, "token": "three"},
5
+ {"type": "TEXT_NODE", "start": 5, "end": 6, "token": " "},
6
+ {"type": "ALTERNATION_NODE", "start": 6, "end": 18, "nodes": [
7
+ {"type": "ALTERNATIVE_NODE", "start": 6, "end": 12, "nodes": [
8
+ {"type": "TEXT_NODE", "start": 6, "end": 12, "token": "hungry"}
9
+ ]},
10
+ {"type": "ALTERNATIVE_NODE", "start": 13, "end": 18, "nodes": [
11
+ {"type": "TEXT_NODE", "start": 13, "end": 18, "token": "blind"}
12
+ ]}
13
+ ]},
14
+ {"type": "TEXT_NODE", "start": 18, "end": 19, "token": " "},
15
+ {"type": "TEXT_NODE", "start": 19, "end": 23, "token": "mice"}
16
+ ]}
@@ -0,0 +1,27 @@
1
+ expression: I select the {int}st/nd/rd/th
2
+ expected: |-
3
+ {"type": "EXPRESSION_NODE", "start": 0, "end": 29, "nodes": [
4
+ {"type": "TEXT_NODE", "start": 0, "end": 1, "token": "I"},
5
+ {"type": "TEXT_NODE", "start": 1, "end": 2, "token": " "},
6
+ {"type": "TEXT_NODE", "start": 2, "end": 8, "token": "select"},
7
+ {"type": "TEXT_NODE", "start": 8, "end": 9, "token": " "},
8
+ {"type": "TEXT_NODE", "start": 9, "end": 12, "token": "the"},
9
+ {"type": "TEXT_NODE", "start": 12, "end": 13, "token": " "},
10
+ {"type": "PARAMETER_NODE", "start": 13, "end": 18, "nodes": [
11
+ {"type": "TEXT_NODE", "start": 14, "end": 17, "token": "int"}
12
+ ]},
13
+ {"type": "ALTERNATION_NODE", "start": 18, "end": 29, "nodes": [
14
+ {"type": "ALTERNATIVE_NODE", "start": 18, "end": 20, "nodes": [
15
+ {"type": "TEXT_NODE", "start": 18, "end": 20, "token": "st"}
16
+ ]},
17
+ {"type": "ALTERNATIVE_NODE", "start": 21, "end": 23, "nodes": [
18
+ {"type": "TEXT_NODE", "start": 21, "end": 23, "token": "nd"}
19
+ ]},
20
+ {"type": "ALTERNATIVE_NODE", "start": 24, "end": 26, "nodes": [
21
+ {"type": "TEXT_NODE", "start": 24, "end": 26, "token": "rd"}
22
+ ]},
23
+ {"type": "ALTERNATIVE_NODE", "start": 27, "end": 29, "nodes": [
24
+ {"type": "TEXT_NODE", "start": 27, "end": 29, "token": "th"}
25
+ ]}
26
+ ]}
27
+ ]}
@@ -0,0 +1,15 @@
1
+ expression: three )blind\ mice/rats
2
+ expected: |-
3
+ {"type": "EXPRESSION_NODE", "start": 0, "end": 23, "nodes": [
4
+ {"type": "TEXT_NODE", "start": 0, "end": 5, "token": "three"},
5
+ {"type": "TEXT_NODE", "start": 5, "end": 6, "token": " "},
6
+ {"type": "ALTERNATION_NODE", "start": 6, "end": 23, "nodes": [
7
+ {"type": "ALTERNATIVE_NODE", "start": 6, "end": 18, "nodes": [
8
+ {"type": "TEXT_NODE", "start": 6, "end": 7, "token": ")"},
9
+ {"type": "TEXT_NODE", "start": 7, "end": 18, "token": "blind mice"}
10
+ ]},
11
+ {"type": "ALTERNATIVE_NODE", "start": 19, "end": 23, "nodes": [
12
+ {"type": "TEXT_NODE", "start": 19, "end": 23, "token": "rats"}
13
+ ]}
14
+ ]}
15
+ ]}
@@ -0,0 +1,8 @@
1
+ expression: three blind\ mice/rats(
2
+ exception: |-
3
+ This Cucumber Expression has a problem at column 23:
4
+
5
+ three blind\ mice/rats(
6
+ ^
7
+ The '(' does not have a matching ')'.
8
+ If you did not intend to use optional text you can use '\(' to escape the optional text
@@ -0,0 +1,12 @@
1
+ expression: '\ three\ hungry/blind\ mice\ '
2
+ expected: |-
3
+ {"type": "EXPRESSION_NODE", "start": 0, "end": 29, "nodes": [
4
+ {"type": "ALTERNATION_NODE", "start": 0, "end": 29, "nodes": [
5
+ {"type": "ALTERNATIVE_NODE", "start": 0, "end": 15, "nodes": [
6
+ {"type": "TEXT_NODE", "start": 0, "end": 15, "token": " three hungry"}
7
+ ]},
8
+ {"type": "ALTERNATIVE_NODE", "start": 16, "end": 29, "nodes": [
9
+ {"type": "TEXT_NODE", "start": 16, "end": 29, "token": "blind mice "}
10
+ ]}
11
+ ]}
12
+ ]}
@@ -0,0 +1,12 @@
1
+ expression: mice/rats
2
+ expected: |-
3
+ {"type": "EXPRESSION_NODE", "start": 0, "end": 9, "nodes": [
4
+ {"type": "ALTERNATION_NODE", "start": 0, "end": 9, "nodes": [
5
+ {"type": "ALTERNATIVE_NODE", "start": 0, "end": 4, "nodes": [
6
+ {"type": "TEXT_NODE", "start": 0, "end": 4, "token": "mice"}
7
+ ]},
8
+ {"type": "ALTERNATIVE_NODE", "start": 5, "end": 9, "nodes": [
9
+ {"type": "TEXT_NODE", "start": 5, "end": 9, "token": "rats"}
10
+ ]}
11
+ ]}
12
+ ]}
@@ -0,0 +1,5 @@
1
+ expression: "{}"
2
+ expected: |-
3
+ {"type": "EXPRESSION_NODE", "start": 0, "end": 2, "nodes": [
4
+ {"type": "PARAMETER_NODE", "start": 0, "end": 2, "nodes": []}
5
+ ]}
@@ -0,0 +1,5 @@
1
+ expression: "}"
2
+ expected: |-
3
+ {"type": "EXPRESSION_NODE", "start": 0, "end": 1, "nodes": [
4
+ {"type": "TEXT_NODE", "start": 0, "end": 1, "token": "}"}
5
+ ]}
@@ -0,0 +1,5 @@
1
+ expression: )
2
+ expected: |-
3
+ {"type": "EXPRESSION_NODE", "start": 0, "end": 1, "nodes": [
4
+ {"type": "TEXT_NODE", "start": 0, "end": 1, "token": ")"}
5
+ ]}
@@ -0,0 +1,8 @@
1
+ expression: /
2
+ expected: |-
3
+ {"type": "EXPRESSION_NODE", "start": 0, "end": 1, "nodes": [
4
+ {"type": "ALTERNATION_NODE", "start": 0, "end": 1, "nodes": [
5
+ {"type": "ALTERNATIVE_NODE", "start": 0, "end": 0, "nodes": []},
6
+ {"type": "ALTERNATIVE_NODE", "start": 1, "end": 1, "nodes": []}
7
+ ]}
8
+ ]}
@@ -0,0 +1,9 @@
1
+ expression: '//'
2
+ expected: |-
3
+ {"type": "EXPRESSION_NODE", "start": 0, "end": 2, "nodes": [
4
+ {"type": "ALTERNATION_NODE", "start": 0, "end": 2, "nodes": [
5
+ {"type": "ALTERNATIVE_NODE", "start": 0, "end": 0, "nodes": []},
6
+ {"type": "ALTERNATIVE_NODE", "start": 1, "end": 1, "nodes": []},
7
+ {"type": "ALTERNATIVE_NODE", "start": 2, "end": 2, "nodes": []}
8
+ ]}
9
+ ]}
@@ -0,0 +1,3 @@
1
+ expression: ""
2
+ expected: |-
3
+ {"type": "EXPRESSION_NODE", "start": 0, "end": 0, "nodes": []}
@@ -0,0 +1,5 @@
1
+ expression: 'mice\/rats'
2
+ expected: |-
3
+ {"type": "EXPRESSION_NODE", "start": 0, "end": 10, "nodes": [
4
+ {"type": "TEXT_NODE", "start": 0, "end": 10, "token": "mice/rats"}
5
+ ]}
@@ -0,0 +1,5 @@
1
+ expression: '\\'
2
+ expected: |-
3
+ {"type": "EXPRESSION_NODE", "start": 0, "end": 2, "nodes": [
4
+ {"type": "TEXT_NODE", "start": 0, "end": 2, "token": "\\"}
5
+ ]}
@@ -0,0 +1,5 @@
1
+ expression: '\('
2
+ expected: |-
3
+ {"type": "EXPRESSION_NODE", "start": 0, "end": 2, "nodes": [
4
+ {"type": "TEXT_NODE", "start": 0, "end": 2, "token": "("}
5
+ ]}
@@ -0,0 +1,15 @@
1
+ expression: three \((very) blind) mice
2
+ expected: |-
3
+ {"type": "EXPRESSION_NODE", "start": 0, "end": 26, "nodes": [
4
+ {"type": "TEXT_NODE", "start": 0, "end": 5, "token": "three"},
5
+ {"type": "TEXT_NODE", "start": 5, "end": 6, "token": " "},
6
+ {"type": "TEXT_NODE", "start": 6, "end": 8, "token": "("},
7
+ {"type": "OPTIONAL_NODE", "start": 8, "end": 14, "nodes": [
8
+ {"type": "TEXT_NODE", "start": 9, "end": 13, "token": "very"}
9
+ ]},
10
+ {"type": "TEXT_NODE", "start": 14, "end": 15, "token": " "},
11
+ {"type": "TEXT_NODE", "start": 15, "end": 20, "token": "blind"},
12
+ {"type": "TEXT_NODE", "start": 20, "end": 21, "token": ")"},
13
+ {"type": "TEXT_NODE", "start": 21, "end": 22, "token": " "},
14
+ {"type": "TEXT_NODE", "start": 22, "end": 26, "token": "mice"}
15
+ ]}
@@ -0,0 +1,10 @@
1
+ expression: three \(blind) mice
2
+ expected: |-
3
+ {"type": "EXPRESSION_NODE", "start": 0, "end": 19, "nodes": [
4
+ {"type": "TEXT_NODE", "start": 0, "end": 5, "token": "three"},
5
+ {"type": "TEXT_NODE", "start": 5, "end": 6, "token": " "},
6
+ {"type": "TEXT_NODE", "start": 6, "end": 13, "token": "(blind"},
7
+ {"type": "TEXT_NODE", "start": 13, "end": 14, "token": ")"},
8
+ {"type": "TEXT_NODE", "start": 14, "end": 15, "token": " "},
9
+ {"type": "TEXT_NODE", "start": 15, "end": 19, "token": "mice"}
10
+ ]}
@@ -0,0 +1,7 @@
1
+ expression: '\(blind)'
2
+
3
+ expected: |-
4
+ {"type": "EXPRESSION_NODE", "start": 0, "end": 8, "nodes": [
5
+ {"type": "TEXT_NODE", "start": 0, "end": 7, "token": "(blind"},
6
+ {"type": "TEXT_NODE", "start": 7, "end": 8, "token": ")"}
7
+ ]}
@@ -0,0 +1,8 @@
1
+ expression: '{'
2
+ exception: |-
3
+ This Cucumber Expression has a problem at column 1:
4
+
5
+ {
6
+ ^
7
+ The '{' does not have a matching '}'.
8
+ If you did not intend to use a parameter you can use '\{' to escape the a parameter
@@ -0,0 +1,8 @@
1
+ expression: (
2
+ exception: |-
3
+ This Cucumber Expression has a problem at column 1:
4
+
5
+ (
6
+ ^
7
+ The '(' does not have a matching ')'.
8
+ If you did not intend to use optional text you can use '\(' to escape the optional text
@@ -0,0 +1,15 @@
1
+ expression: three ((very) blind) mice
2
+ expected: |-
3
+ {"type": "EXPRESSION_NODE", "start": 0, "end": 25, "nodes": [
4
+ {"type": "TEXT_NODE", "start": 0, "end": 5, "token": "three"},
5
+ {"type": "TEXT_NODE", "start": 5, "end": 6, "token": " "},
6
+ {"type": "OPTIONAL_NODE", "start": 6, "end": 20, "nodes": [
7
+ {"type": "OPTIONAL_NODE", "start": 7, "end": 13, "nodes": [
8
+ {"type": "TEXT_NODE", "start": 8, "end": 12, "token": "very"}
9
+ ]},
10
+ {"type": "TEXT_NODE", "start": 13, "end": 14, "token": " "},
11
+ {"type": "TEXT_NODE", "start": 14, "end": 19, "token": "blind"}
12
+ ]},
13
+ {"type": "TEXT_NODE", "start": 20, "end": 21, "token": " "},
14
+ {"type": "TEXT_NODE", "start": 21, "end": 25, "token": "mice"}
15
+ ]}
@@ -0,0 +1,12 @@
1
+ expression: three (blind) mice
2
+
3
+ expected: |-
4
+ {"type": "EXPRESSION_NODE", "start": 0, "end": 18, "nodes": [
5
+ {"type": "TEXT_NODE", "start": 0, "end": 5, "token": "three"},
6
+ {"type": "TEXT_NODE", "start": 5, "end": 6, "token": " "},
7
+ {"type": "OPTIONAL_NODE", "start": 6, "end": 13, "nodes": [
8
+ {"type": "TEXT_NODE", "start": 7, "end": 12, "token": "blind"}
9
+ ]},
10
+ {"type": "TEXT_NODE", "start": 13, "end": 14, "token": " "},
11
+ {"type": "TEXT_NODE", "start": 14, "end": 18, "token": "mice"}
12
+ ]}
@@ -0,0 +1,7 @@
1
+ expression: (blind)
2
+ expected: |-
3
+ {"type": "EXPRESSION_NODE", "start": 0, "end": 7, "nodes": [
4
+ {"type": "OPTIONAL_NODE", "start": 0, "end": 7, "nodes": [
5
+ {"type": "TEXT_NODE", "start": 1, "end": 6, "token": "blind"}
6
+ ]}
7
+ ]}
@@ -0,0 +1,7 @@
1
+ expression: "{string}"
2
+ expected: |-
3
+ {"type": "EXPRESSION_NODE", "start": 0, "end": 8, "nodes": [
4
+ {"type": "PARAMETER_NODE", "start": 0, "end": 8, "nodes": [
5
+ {"type": "TEXT_NODE", "start": 1, "end": 7, "token": "string"}
6
+ ]}
7
+ ]}
@@ -0,0 +1,9 @@
1
+ expression: three blind mice
2
+ expected: |-
3
+ {"type": "EXPRESSION_NODE", "start": 0, "end": 16, "nodes": [
4
+ {"type": "TEXT_NODE", "start": 0, "end": 5, "token": "three"},
5
+ {"type": "TEXT_NODE", "start": 5, "end": 6, "token": " "},
6
+ {"type": "TEXT_NODE", "start": 6, "end": 11, "token": "blind"},
7
+ {"type": "TEXT_NODE", "start": 11, "end": 12, "token": " "},
8
+ {"type": "TEXT_NODE", "start": 12, "end": 16, "token": "mice"}
9
+ ]}
@@ -0,0 +1,8 @@
1
+ expression: "{string"
2
+ exception: |-
3
+ This Cucumber Expression has a problem at column 1:
4
+
5
+ {string
6
+ ^
7
+ The '{' does not have a matching '}'.
8
+ If you did not intend to use a parameter you can use '\{' to escape the a parameter