cucumber-expressions 7.0.0 → 8.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/cucumber-expressions.gemspec +3 -3
- data/default.mk +21 -12
- data/lib/cucumber/cucumber_expressions/cucumber_expression_generator.rb +1 -1
- data/lib/cucumber/cucumber_expressions/parameter_type.rb +1 -1
- data/lib/cucumber/cucumber_expressions/parameter_type_matcher.rb +17 -1
- data/lib/cucumber/cucumber_expressions/parameter_type_registry.rb +1 -1
- data/lib/cucumber/cucumber_expressions/tree_regexp.rb +30 -15
- data/scripts/update-gemspec +23 -0
- data/spec/cucumber/cucumber_expressions/cucumber_expression_generator_spec.rb +59 -7
- data/spec/cucumber/cucumber_expressions/cucumber_expression_regexp_spec.rb +1 -1
- data/spec/cucumber/cucumber_expressions/cucumber_expression_spec.rb +36 -2
- data/spec/cucumber/cucumber_expressions/regular_expression_spec.rb +0 -8
- data/spec/cucumber/cucumber_expressions/tree_regexp_spec.rb +36 -7
- metadata +8 -7
- data/.travis.yml +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edd65ea4b92b8499008e6e821a06707177e1f2c1284f34f53c278f484d16b1c3
|
4
|
+
data.tar.gz: c24fc7d2c8ad31f90c46c65fcdeddf3f8ac9b1bf9be2933c5d5965fc513fb251
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee2c5bd392bc5e4ae1246944c23098390259bb36563cec9d0fd3485030c2947d366f4e15508718dd83c940da91ce0fc0789f2f91328f3996d5b5e50218376e60
|
7
|
+
data.tar.gz: 1ea553353102791bef111b07a399f21ef42c7e97c98dc20e1b01c9ef16894fbea70ac0cd755a08df9416b0f03a8b99a49a34216260a17a7b3eb6b362ed66ffea
|
data/README.md
CHANGED
@@ -2,4 +2,4 @@
|
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/cucumber/cucumber-expressions-ruby.svg?branch=master)](https://travis-ci.org/cucumber/cucumber-expressions-ruby)
|
4
4
|
|
5
|
-
[The docs are here](https://
|
5
|
+
[The docs are here](https://cucumber.io/docs/cucumber/cucumber-expressions/).
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.name = 'cucumber-expressions'
|
4
|
-
s.version = '
|
4
|
+
s.version = '8.0.0'
|
5
5
|
s.authors = ["Aslak Hellesøy"]
|
6
6
|
s.description = 'Cucumber Expressions - a simpler alternative to Regular Expressions'
|
7
7
|
s.summary = "cucumber-expressions-#{s.version}"
|
@@ -9,12 +9,12 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.homepage = "https://github.com/cucumber/cucumber-expressions-ruby#readme"
|
10
10
|
s.platform = Gem::Platform::RUBY
|
11
11
|
s.license = "MIT"
|
12
|
-
s.required_ruby_version = ">=
|
12
|
+
s.required_ruby_version = ">= 2.3"
|
13
13
|
|
14
14
|
s.metadata = {
|
15
15
|
'bug_tracker_uri' => 'https://github.com/cucumber/cucumber/issues',
|
16
16
|
'changelog_uri' => 'https://github.com/cucumber/cucumber/blob/master/cucumber-expressions/CHANGELOG.md',
|
17
|
-
'documentation_uri' => 'https://
|
17
|
+
'documentation_uri' => 'https://cucumber.io/docs/cucumber/cucumber-expressions/',
|
18
18
|
'mailing_list_uri' => 'https://groups.google.com/forum/#!forum/cukes',
|
19
19
|
'source_code_uri' => 'https://github.com/cucumber/cucumber/blob/master/cucumber-expressions/ruby',
|
20
20
|
}
|
data/default.mk
CHANGED
@@ -1,23 +1,14 @@
|
|
1
1
|
SHELL := /usr/bin/env bash
|
2
2
|
RUBY_SOURCE_FILES = $(shell find . -name "*.rb")
|
3
|
-
|
4
|
-
|
5
|
-
ifdef TRAVIS_BRANCH
|
6
|
-
LIBRARY_VERSION=$(TRAVIS_BRANCH)
|
7
|
-
endif
|
8
|
-
ifdef TRAVIS_TAG
|
9
|
-
LIBRARY_VERSION=$(TRAVIS_TAG)
|
10
|
-
endif
|
11
|
-
ifndef LIBRARY_VERSION
|
12
|
-
LIBRARY_VERSION=$(shell git rev-parse --abbrev-ref HEAD)
|
13
|
-
endif
|
3
|
+
GEMSPEC = $(shell find . -name "*.gemspec")
|
14
4
|
|
15
5
|
default: .tested
|
16
6
|
.PHONY: default
|
17
7
|
|
18
8
|
.deps: Gemfile.lock
|
9
|
+
touch $@
|
19
10
|
|
20
|
-
Gemfile.lock: Gemfile $(
|
11
|
+
Gemfile.lock: Gemfile $(GEMSPEC)
|
21
12
|
bundle install
|
22
13
|
touch $@
|
23
14
|
|
@@ -25,6 +16,24 @@ Gemfile.lock: Gemfile $(GEMSPECS)
|
|
25
16
|
bundle exec rspec --color
|
26
17
|
touch $@
|
27
18
|
|
19
|
+
update-dependencies:
|
20
|
+
./scripts/update-gemspec
|
21
|
+
.PHONY: update-dependencies
|
22
|
+
|
23
|
+
update-version:
|
24
|
+
ifdef NEW_VERSION
|
25
|
+
sed -i "s/\(s\.version *= *'\)[0-9]*\.[0-9]*\.[0-9]*\('\)/\1$(NEW_VERSION)\2/" $(GEMSPEC)
|
26
|
+
else
|
27
|
+
@echo -e "\033[0;NEW_VERSION is not defined. Can't update version :-(\033[0m"
|
28
|
+
exit 1
|
29
|
+
endif
|
30
|
+
.PHONY: update-version
|
31
|
+
|
32
|
+
publish: .deps
|
33
|
+
gem build $(GEMSPEC)
|
34
|
+
gem push $$(find . -name "*.gem")
|
35
|
+
.PHONY: publish
|
36
|
+
|
28
37
|
clean: clean-ruby
|
29
38
|
.PHONY: clean
|
30
39
|
|
@@ -89,7 +89,7 @@ module Cucumber
|
|
89
89
|
regexps = parameter_type.regexps
|
90
90
|
regexps.each do |regexp|
|
91
91
|
regexp = Regexp.new("(#{regexp})")
|
92
|
-
result.push(ParameterTypeMatcher.new(parameter_type, regexp, text))
|
92
|
+
result.push(ParameterTypeMatcher.new(parameter_type, regexp, text, 0))
|
93
93
|
end
|
94
94
|
result
|
95
95
|
end
|
@@ -11,7 +11,7 @@ module Cucumber
|
|
11
11
|
def advance_to(new_match_position)
|
12
12
|
(new_match_position...@text.length).each {|advancedPos|
|
13
13
|
matcher = self.class.new(parameter_type, @regexp, @text, advancedPos)
|
14
|
-
if matcher.find
|
14
|
+
if matcher.find && matcher.full_word?
|
15
15
|
return matcher
|
16
16
|
end
|
17
17
|
}
|
@@ -23,6 +23,10 @@ module Cucumber
|
|
23
23
|
!@match.nil? && !group.empty?
|
24
24
|
end
|
25
25
|
|
26
|
+
def full_word?
|
27
|
+
space_before_match_or_sentence_start? && space_after_match_or_sentence_end?
|
28
|
+
end
|
29
|
+
|
26
30
|
def start
|
27
31
|
@match.begin(0)
|
28
32
|
end
|
@@ -38,6 +42,18 @@ module Cucumber
|
|
38
42
|
return length_comparison if length_comparison != 0
|
39
43
|
0
|
40
44
|
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def space_before_match_or_sentence_start?
|
49
|
+
match_begin = @match.begin(0)
|
50
|
+
match_begin == 0 || @text[match_begin - 1].match(/\s|\p{P}/)
|
51
|
+
end
|
52
|
+
|
53
|
+
def space_after_match_or_sentence_end?
|
54
|
+
match_end = @match.end(0)
|
55
|
+
match_end == @text.length || @text[match_end].match(/\s|\p{P}/)
|
56
|
+
end
|
41
57
|
end
|
42
58
|
end
|
43
59
|
end
|
@@ -6,7 +6,7 @@ module Cucumber
|
|
6
6
|
module CucumberExpressions
|
7
7
|
class ParameterTypeRegistry
|
8
8
|
INTEGER_REGEXPS = [/-?\d+/, /\d+/]
|
9
|
-
FLOAT_REGEXP =
|
9
|
+
FLOAT_REGEXP = /(?=.*\d.*)[-+]?\d*(?:\.(?=\d.*))?\d*(?:\d+[E][-+]?\d+)?/
|
10
10
|
WORD_REGEXP = /[^\s]+/
|
11
11
|
STRING_REGEXP = /"([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)'/
|
12
12
|
ANONYMOUS_REGEXP = /.*/
|
@@ -8,45 +8,49 @@ module Cucumber
|
|
8
8
|
|
9
9
|
def initialize(regexp)
|
10
10
|
@regexp = regexp.is_a?(Regexp) ? regexp : Regexp.new(regexp)
|
11
|
-
stack = [GroupBuilder.new]
|
11
|
+
@stack = [GroupBuilder.new]
|
12
12
|
group_start_stack = []
|
13
13
|
last = nil
|
14
14
|
escaping = false
|
15
|
-
non_capturing_maybe = false
|
15
|
+
@non_capturing_maybe = false
|
16
|
+
@name_capturing_maybe = false
|
16
17
|
char_class = false
|
17
18
|
|
18
|
-
@regexp.source.
|
19
|
+
@regexp.source.each_char.with_index do |c, n|
|
19
20
|
if c == '[' && !escaping
|
20
21
|
char_class = true
|
21
22
|
elsif c == ']' && !escaping
|
22
23
|
char_class = false
|
23
24
|
elsif c == '(' && !escaping && !char_class
|
24
|
-
stack.push(GroupBuilder.new)
|
25
|
+
@stack.push(GroupBuilder.new)
|
25
26
|
group_start_stack.push(n+1)
|
26
|
-
non_capturing_maybe = false
|
27
|
+
@non_capturing_maybe = false
|
27
28
|
elsif c == ')' && !escaping && !char_class
|
28
|
-
gb = stack.pop
|
29
|
+
gb = @stack.pop
|
29
30
|
group_start = group_start_stack.pop
|
30
31
|
if gb.capturing?
|
31
32
|
gb.source = @regexp.source[group_start...n]
|
32
|
-
stack.last.add(gb)
|
33
|
+
@stack.last.add(gb)
|
33
34
|
else
|
34
|
-
gb.move_children_to(stack.last)
|
35
|
+
gb.move_children_to(@stack.last)
|
35
36
|
end
|
36
|
-
|
37
|
+
end_group
|
37
38
|
elsif c == '?' && last == '('
|
38
|
-
non_capturing_maybe = true
|
39
|
-
elsif c == '
|
40
|
-
|
41
|
-
|
42
|
-
|
39
|
+
@non_capturing_maybe = true
|
40
|
+
elsif (c == '<') && @non_capturing_maybe
|
41
|
+
@name_capturing_maybe = true
|
42
|
+
elsif (c == ':' || c == '!' || c == '=') && last == '?' && @non_capturing_maybe
|
43
|
+
end_non_capturing_group()
|
44
|
+
elsif (c == '=' || c == '!') && last == '<' && @name_capturing_maybe
|
45
|
+
end_non_capturing_group()
|
46
|
+
elsif @name_capturing_maybe
|
43
47
|
raise CucumberExpressionError.new("Named capture groups are not supported. See https://github.com/cucumber/cucumber/issues/329")
|
44
48
|
end
|
45
49
|
|
46
50
|
escaping = c == '\\' && !escaping
|
47
51
|
last = c
|
48
52
|
end
|
49
|
-
@group_builder = stack.pop
|
53
|
+
@group_builder = @stack.pop
|
50
54
|
end
|
51
55
|
|
52
56
|
def match(s)
|
@@ -56,6 +60,17 @@ module Cucumber
|
|
56
60
|
@group_builder.build(match, group_indices)
|
57
61
|
end
|
58
62
|
|
63
|
+
private
|
64
|
+
|
65
|
+
def end_non_capturing_group
|
66
|
+
@stack.last.set_non_capturing!
|
67
|
+
end_group
|
68
|
+
end
|
69
|
+
|
70
|
+
def end_group
|
71
|
+
@non_capturing_maybe = false
|
72
|
+
@name_capturing_maybe = false
|
73
|
+
end
|
59
74
|
end
|
60
75
|
end
|
61
76
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
#
|
3
|
+
# Updates the *.gemspec in the current directory to use the latest releases of gems
|
4
|
+
#
|
5
|
+
set -uf -o pipefail
|
6
|
+
IFS=$'\n'
|
7
|
+
|
8
|
+
gemspec=$(find . -type f -maxdepth 1 -name "*.gemspec")
|
9
|
+
add_dependency_lines=$(cat ${gemspec} | grep "s.add_dependency '[^']*', '")
|
10
|
+
if [ $? -ne 0 ]; then
|
11
|
+
# No add_dependency_lines found - nothing to do
|
12
|
+
exit 0
|
13
|
+
fi
|
14
|
+
|
15
|
+
set -e
|
16
|
+
|
17
|
+
gems=$(echo "${add_dependency_lines}" | tr -s ' ' | cut -d ' ' -f3 | cut -d"'" -f 2)
|
18
|
+
while read -r gem; do
|
19
|
+
gem_line=$(gem list "${gem}" --remote --all --no-prerelease | grep "${gem}")
|
20
|
+
latest_version=$(echo "${gem_line}" | cut -d'(' -f2 | cut -d',' -f1)
|
21
|
+
cat "${gemspec}" | sed "s/s.add_dependency '${gem}', .*/s.add_dependency '${gem}', '~> ${latest_version}'/" > ${gemspec}.tmp
|
22
|
+
mv ${gemspec}.tmp ${gemspec}
|
23
|
+
done <<< "${gems}"
|
@@ -109,32 +109,32 @@ module Cucumber
|
|
109
109
|
))
|
110
110
|
@parameter_type_registry.define_parameter_type(ParameterType.new(
|
111
111
|
'optional-hotel',
|
112
|
-
/(
|
112
|
+
/(1 hotel)?/,
|
113
113
|
String,
|
114
114
|
lambda {|s| s},
|
115
115
|
true,
|
116
116
|
false
|
117
117
|
))
|
118
118
|
|
119
|
-
expression = @generator.generate_expressions("I reach
|
120
|
-
# While you would expect this to be `I reach Stage{int}: {optional-flight}-{optional-hotel}`
|
119
|
+
expression = @generator.generate_expressions("I reach Stage 4: 1st flight -1 hotel")[0]
|
120
|
+
# While you would expect this to be `I reach Stage {int}: {optional-flight} -{optional-hotel}`
|
121
121
|
# the `-1` causes {int} to match just before {optional-hotel}.
|
122
|
-
expect(expression.source).to eq("I reach Stage{int}: {optional-flight}{int}
|
122
|
+
expect(expression.source).to eq("I reach Stage {int}: {optional-flight} {int} hotel")
|
123
123
|
end
|
124
124
|
|
125
125
|
it "generates at most 256 expressions" do
|
126
126
|
for i in 0..3
|
127
127
|
@parameter_type_registry.define_parameter_type(ParameterType.new(
|
128
128
|
"my-type-#{i}",
|
129
|
-
/[a-z]/,
|
129
|
+
/([a-z] )*?[a-z]/,
|
130
130
|
String,
|
131
131
|
lambda {|s| s},
|
132
132
|
true,
|
133
133
|
false
|
134
134
|
))
|
135
135
|
end
|
136
|
-
# This would otherwise generate 4^11=
|
137
|
-
expressions = @generator.generate_expressions("a
|
136
|
+
# This would otherwise generate 4^11=4194300 expressions and consume just shy of 1.5GB.
|
137
|
+
expressions = @generator.generate_expressions("a s i m p l e s t e p")
|
138
138
|
expect(expressions.length).to eq(256)
|
139
139
|
end
|
140
140
|
|
@@ -162,6 +162,58 @@ module Cucumber
|
|
162
162
|
expect(expressions[1].source).to eq("{zero-or-more} {zero-or-more} {zero-or-more}")
|
163
163
|
end
|
164
164
|
|
165
|
+
context "does not suggest parameter when match is" do
|
166
|
+
before do
|
167
|
+
@parameter_type_registry.define_parameter_type(ParameterType.new(
|
168
|
+
'direction',
|
169
|
+
/(up|down)/,
|
170
|
+
String,
|
171
|
+
lambda {|s| s},
|
172
|
+
true,
|
173
|
+
false
|
174
|
+
))
|
175
|
+
end
|
176
|
+
|
177
|
+
it "at the beginning of a word" do
|
178
|
+
expect(@generator.generate_expression("When I download a picture").source).not_to eq("When I {direction}load a picture")
|
179
|
+
expect(@generator.generate_expression("When I download a picture").source).to eq("When I download a picture")
|
180
|
+
end
|
181
|
+
|
182
|
+
it "inside a word" do
|
183
|
+
expect(@generator.generate_expression("When I watch the muppet show").source).not_to eq("When I watch the m{direction}pet show")
|
184
|
+
expect(@generator.generate_expression("When I watch the muppet show").source).to eq("When I watch the muppet show")
|
185
|
+
end
|
186
|
+
|
187
|
+
it "at the end of a word" do
|
188
|
+
expect(@generator.generate_expression("When I create a group").source).not_to eq("When I create a gro{direction}")
|
189
|
+
expect(@generator.generate_expression("When I create a group").source).to eq("When I create a group")
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
context "does suggest parameter when match is" do
|
194
|
+
before do
|
195
|
+
@parameter_type_registry.define_parameter_type(ParameterType.new(
|
196
|
+
'direction',
|
197
|
+
/(up|down)/,
|
198
|
+
String,
|
199
|
+
lambda {|s| s},
|
200
|
+
true,
|
201
|
+
false
|
202
|
+
))
|
203
|
+
end
|
204
|
+
|
205
|
+
it "a full word" do
|
206
|
+
expect(@generator.generate_expression("When I go down the road").source).to eq("When I go {direction} the road")
|
207
|
+
expect(@generator.generate_expression("When I walk up the hill").source).to eq("When I walk {direction} the hill")
|
208
|
+
expect(@generator.generate_expression("up the hill, the road goes down").source).to eq("{direction} the hill, the road goes {direction}")
|
209
|
+
end
|
210
|
+
|
211
|
+
it 'wrapped around punctuation characters' do
|
212
|
+
expect(@generator.generate_expression("When direction is:down").source).to eq("When direction is:{direction}")
|
213
|
+
expect(@generator.generate_expression("Then direction is down.").source).to eq("Then direction is {direction}.")
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
165
217
|
def assert_expression(expected_expression, expected_argument_names, text)
|
166
218
|
generated_expression = @generator.generate_expression(text)
|
167
219
|
expect(generated_expression.parameter_names).to eq(expected_argument_names)
|
@@ -34,7 +34,7 @@ module Cucumber
|
|
34
34
|
it "translates parameters" do
|
35
35
|
assert_regexp(
|
36
36
|
"I have {float} cukes at {int} o'clock",
|
37
|
-
/^I have (
|
37
|
+
/^I have ((?=.*\d.*)[-+]?\d*(?:\.(?=\d.*))?\d*(?:\d+[E][-+]?\d+)?) cukes at ((?:-?\d+)|(?:\d+)) o'clock$/
|
38
38
|
)
|
39
39
|
end
|
40
40
|
|
@@ -71,9 +71,43 @@ module Cucumber
|
|
71
71
|
expect(match("{int}", "1.22")).to be_nil
|
72
72
|
end
|
73
73
|
|
74
|
+
it "matches int as float" do
|
75
|
+
expect(match("{float}", "0")).to eq([0.0])
|
76
|
+
end
|
77
|
+
|
74
78
|
it "matches float" do
|
75
|
-
expect(match("{float}", "
|
76
|
-
expect(match("{float}", ".
|
79
|
+
expect(match("{float}", "")).to eq(nil)
|
80
|
+
expect(match("{float}", ".")).to eq(nil)
|
81
|
+
expect(match("{float}", ",")).to eq(nil)
|
82
|
+
expect(match("{float}", "-")).to eq(nil)
|
83
|
+
expect(match("{float}", "E")).to eq(nil)
|
84
|
+
expect(match("{float}", "1,")).to eq(nil)
|
85
|
+
expect(match("{float}", ",1")).to eq(nil)
|
86
|
+
expect(match("{float}", "1.")).to eq(nil)
|
87
|
+
|
88
|
+
expect(match("{float}", "1")).to eq([1])
|
89
|
+
expect(match("{float}", "-1")).to eq([-1])
|
90
|
+
expect(match("{float}", "1.1")).to eq([1.1])
|
91
|
+
expect(match("{float}", "1,000")).to eq(nil)
|
92
|
+
expect(match("{float}", "1,000,0")).to eq(nil)
|
93
|
+
expect(match("{float}", "1,000.1")).to eq(nil)
|
94
|
+
expect(match("{float}", "1,000,10")).to eq(nil)
|
95
|
+
expect(match("{float}", "1,0.1")).to eq(nil)
|
96
|
+
expect(match("{float}", "1,000,000.1")).to eq(nil)
|
97
|
+
expect(match("{float}", "-1.1")).to eq([-1.1])
|
98
|
+
|
99
|
+
expect(match("{float}", ".1")).to eq([0.1])
|
100
|
+
expect(match("{float}", "-.1")).to eq([-0.1])
|
101
|
+
expect(match("{float}", "-.1000001")).to eq([-0.1000001])
|
102
|
+
expect(match("{float}", "1E1")).to eq([10.0])
|
103
|
+
expect(match("{float}", ".1E1")).to eq([1])
|
104
|
+
expect(match("{float}", "E1")).to eq(nil)
|
105
|
+
expect(match("{float}", "-.1E-1")).to eq([-0.01])
|
106
|
+
expect(match("{float}", "-.1E-2")).to eq([-0.001])
|
107
|
+
expect(match("{float}", "-.1E+1")).to eq([-1])
|
108
|
+
expect(match("{float}", "-.1E+2")).to eq([-10])
|
109
|
+
expect(match("{float}", "-.1E1")).to eq([-1])
|
110
|
+
expect(match("{float}", "-.1E2")).to eq([-10])
|
77
111
|
end
|
78
112
|
|
79
113
|
it "matches anonymous" do
|
@@ -32,14 +32,6 @@ module Cucumber
|
|
32
32
|
expect( match(/(\d+)/, "22") ).to eq([22])
|
33
33
|
end
|
34
34
|
|
35
|
-
it "transforms float without integer part" do
|
36
|
-
expect( match(/(-?\d*\.\d+)/, ".22") ).to eq([0.22])
|
37
|
-
end
|
38
|
-
|
39
|
-
it "transforms float with sign" do
|
40
|
-
expect( match(/(-?\d*\.\d+)/, "-1.22") ).to eq([-1.22])
|
41
|
-
end
|
42
|
-
|
43
35
|
it "returns nil when there is no match" do
|
44
36
|
expect( match(/hello/, "world") ).to be_nil
|
45
37
|
end
|
@@ -17,13 +17,42 @@ module Cucumber
|
|
17
17
|
expect(group.children[1].value).to eq('c')
|
18
18
|
end
|
19
19
|
|
20
|
-
it 'ignores non-capturing
|
21
|
-
tr = TreeRegexp.new(/
|
22
|
-
group = tr.match('
|
23
|
-
expect(group.value).to eq('
|
24
|
-
expect(group.children
|
25
|
-
|
26
|
-
|
20
|
+
it 'ignores `?:` as a non-capturing group' do
|
21
|
+
tr = TreeRegexp.new(/a(?:b)(c)/)
|
22
|
+
group = tr.match('abc')
|
23
|
+
expect(group.value).to eq('abc')
|
24
|
+
expect(group.children.length).to eq 1
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'ignores `?!` as a non-capturing group' do
|
28
|
+
tr = TreeRegexp.new(/a(?!b)(.+)/)
|
29
|
+
group = tr.match('aBc')
|
30
|
+
expect(group.value).to eq('aBc')
|
31
|
+
expect(group.children.length).to eq 1
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'ignores `?=` as a non-capturing group' do
|
35
|
+
tr = TreeRegexp.new(/a(?=b)(.+)$/)
|
36
|
+
group = tr.match('abc')
|
37
|
+
expect(group.value).to eq('abc')
|
38
|
+
expect(group.children[0].value).to eq('bc')
|
39
|
+
expect(group.children.length).to eq 1
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'ignores `?<=` as a non-capturing group' do
|
43
|
+
tr = TreeRegexp.new(/a(.+)(?<=c)$/)
|
44
|
+
group = tr.match('abc')
|
45
|
+
expect(group.value).to eq('abc')
|
46
|
+
expect(group.children[0].value).to eq('bc')
|
47
|
+
expect(group.children.length).to eq 1
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'ignores `?<!` as a non-capturing group' do
|
51
|
+
tr = TreeRegexp.new(/a(.+)(?<!b)$/)
|
52
|
+
group = tr.match('abc')
|
53
|
+
expect(group.value).to eq('abc')
|
54
|
+
expect(group.children[0].value).to eq('bc')
|
55
|
+
expect(group.children.length).to eq 1
|
27
56
|
end
|
28
57
|
|
29
58
|
it 'matches optional group' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-expressions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 8.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aslak Hellesøy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -77,7 +77,6 @@ files:
|
|
77
77
|
- ".rspec"
|
78
78
|
- ".rsync"
|
79
79
|
- ".subrepo"
|
80
|
-
- ".travis.yml"
|
81
80
|
- Gemfile
|
82
81
|
- LICENSE
|
83
82
|
- Makefile
|
@@ -99,6 +98,7 @@ files:
|
|
99
98
|
- lib/cucumber/cucumber_expressions/parameter_type_registry.rb
|
100
99
|
- lib/cucumber/cucumber_expressions/regular_expression.rb
|
101
100
|
- lib/cucumber/cucumber_expressions/tree_regexp.rb
|
101
|
+
- scripts/update-gemspec
|
102
102
|
- spec/capture_warnings.rb
|
103
103
|
- spec/coverage.rb
|
104
104
|
- spec/cucumber/cucumber_expressions/combinatorial_generated_expression_factory_test.rb
|
@@ -117,7 +117,7 @@ licenses:
|
|
117
117
|
metadata:
|
118
118
|
bug_tracker_uri: https://github.com/cucumber/cucumber/issues
|
119
119
|
changelog_uri: https://github.com/cucumber/cucumber/blob/master/cucumber-expressions/CHANGELOG.md
|
120
|
-
documentation_uri: https://
|
120
|
+
documentation_uri: https://cucumber.io/docs/cucumber/cucumber-expressions/
|
121
121
|
mailing_list_uri: https://groups.google.com/forum/#!forum/cukes
|
122
122
|
source_code_uri: https://github.com/cucumber/cucumber/blob/master/cucumber-expressions/ruby
|
123
123
|
post_install_message:
|
@@ -129,17 +129,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
129
129
|
requirements:
|
130
130
|
- - ">="
|
131
131
|
- !ruby/object:Gem::Version
|
132
|
-
version:
|
132
|
+
version: '2.3'
|
133
133
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
134
|
requirements:
|
135
135
|
- - ">="
|
136
136
|
- !ruby/object:Gem::Version
|
137
137
|
version: '0'
|
138
138
|
requirements: []
|
139
|
-
|
139
|
+
rubyforge_project:
|
140
|
+
rubygems_version: 2.7.6.2
|
140
141
|
signing_key:
|
141
142
|
specification_version: 4
|
142
|
-
summary: cucumber-expressions-
|
143
|
+
summary: cucumber-expressions-8.0.0
|
143
144
|
test_files:
|
144
145
|
- spec/capture_warnings.rb
|
145
146
|
- spec/coverage.rb
|
data/.travis.yml
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
sudo: false
|
2
|
-
language: ruby
|
3
|
-
rvm:
|
4
|
-
- 2.5.3
|
5
|
-
- 2.4.5
|
6
|
-
- 2.3.8
|
7
|
-
- jruby-9.2.0.0
|
8
|
-
script: make default
|
9
|
-
matrix:
|
10
|
-
allow_failures:
|
11
|
-
- rvm: jruby-9.2.0.0
|
12
|
-
jobs:
|
13
|
-
include:
|
14
|
-
- stage: deploy
|
15
|
-
ruby: 2.5.3
|
16
|
-
deploy:
|
17
|
-
skip_cleanup: true
|
18
|
-
provider: rubygems
|
19
|
-
gem: cucumber-expressions
|
20
|
-
on:
|
21
|
-
tags: true
|
22
|
-
api_key:
|
23
|
-
secure: qe+bx0MBxImttvjLt5TVkxWlanjPkSLzqmI6q3LlrhDcNiEy7jEJhBWEdVWWD3l6FG/1AY+XN1o18Re7eaAuun8C8QKmT6MjyMsYlf4bXMH2kfJ0IeRuNne1JRSvqVG6rAlVYHvHGJsReWGwfLAxvaEN0xAmx0cTW2MAmswUtV0LWFqMohV83Vbdcgsdvk2VMvtrtWuZTGod/o1QtcIcVimdnOjvdT79lo60IjgSa+tS7B7hEoehPa1kXZs5QYMEBhZOdIxG0rXCbIzz9wAY/4V4Z2F7SaPNBCuDZXz8Fmv9ZrAEYRsPGnNAbhLX3LFpxUEzmyHwubRRIysFCXrjgDakj4oSBiYAQResGqU0EBcbLiub1rNT72XpXbydI3N8NDdLg2CyZlAE83r7aTkEPdTvNoNwVfLQxpzP9GDKAFj5Fz4VdR0BiGhB+C5uqacpRByjiOyP2G8m2sqQhW6nTxYh61ZjCb38OLlHkdi2t7qECDD8ALlTgWPiVoeFz/cH7wVQR5dD5LoFXCq/BmOoOVGdYc8VbRyy/MPJWEepxK+v0j+LQlAwZdrtqvnE9fYKh8spQQ5+WQi5MfPWJzeXl+SzRFp5l380C3HpjYT4G/5TUaLlPzkPtpehsft9AwqgWiBvuhje2P+MesRk/tUtlWitBrpVLKCG+Dnt2fzhXIE=
|