cucumber-tag-expressions 2.0.4 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cucumber/tag_expressions/expressions.rb +2 -2
- data/lib/cucumber/tag_expressions/parser.rb +30 -1
- data/spec/expressions_spec.rb +29 -0
- data/spec/parser_spec.rb +5 -1
- metadata +13 -36
- data/spec/coverage.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: add075dc395b297351352601837188db90a7e347035845e63e8af7028ecc9d90
|
4
|
+
data.tar.gz: d9e1ed8d2291b2338c2a64303581e6cfa84854265aff0422d75bf8641f156c5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 258a7f1a40ba0022491144dba178f8b6ac6a2e9c6180273e2c19244981b463651cb586c9ee6bf4acf4c34c42400f28305165d75571749be6de275fe9fb68d3ed
|
7
|
+
data.tar.gz: e03fbb76b4a951de7a8f4a1d6a3f60b3d47ed9c79b158e729ec153880b36bb28181bbc95c14125cd6ace08ab3578def4ca68781d90fbee64f455d04e4a6ad232
|
@@ -3,7 +3,7 @@ module Cucumber
|
|
3
3
|
# Literal expression node
|
4
4
|
class Literal
|
5
5
|
def initialize(value)
|
6
|
-
@value = value
|
6
|
+
@value = value
|
7
7
|
end
|
8
8
|
|
9
9
|
def evaluate(variables)
|
@@ -11,7 +11,7 @@ module Cucumber
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def to_s
|
14
|
-
@value.gsub(/\(/,
|
14
|
+
@value.gsub(/\\/, "\\\\\\\\").gsub(/\(/, "\\(").gsub(/\)/, "\\)")
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -53,7 +53,36 @@ module Cucumber
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def tokens(infix_expression)
|
56
|
-
|
56
|
+
escaped = false
|
57
|
+
token = ""
|
58
|
+
result = []
|
59
|
+
infix_expression.chars.each do | ch |
|
60
|
+
if ch == '\\' && !escaped
|
61
|
+
escaped = true
|
62
|
+
else
|
63
|
+
if ch.match(/\s/)
|
64
|
+
if token.length > 0
|
65
|
+
result.push(token)
|
66
|
+
token = ""
|
67
|
+
end
|
68
|
+
else
|
69
|
+
if (ch == '(' || ch == ')') && !escaped
|
70
|
+
if token.length > 0
|
71
|
+
result.push(token)
|
72
|
+
token = ""
|
73
|
+
end
|
74
|
+
result.push(ch)
|
75
|
+
else
|
76
|
+
token = token + ch
|
77
|
+
end
|
78
|
+
end
|
79
|
+
escaped = false
|
80
|
+
end
|
81
|
+
end
|
82
|
+
if token.length > 0
|
83
|
+
result.push(token)
|
84
|
+
end
|
85
|
+
result
|
57
86
|
end
|
58
87
|
|
59
88
|
def process_tokens!(infix_expression)
|
data/spec/expressions_spec.rb
CHANGED
@@ -52,4 +52,33 @@ describe 'Expression node' do
|
|
52
52
|
include_examples 'expression node', infix_expression, data
|
53
53
|
end
|
54
54
|
end
|
55
|
+
|
56
|
+
describe Cucumber::TagExpressions::Or do
|
57
|
+
context '#evaluate' do
|
58
|
+
infix_expression = 'x\\\\ or (y\\\\\\)) or (z\\\\)'
|
59
|
+
data = [[%w(), false],
|
60
|
+
[%w(x), false],
|
61
|
+
[%w(y\)), false],
|
62
|
+
[%w(z), false],
|
63
|
+
[%w(x\\), true],
|
64
|
+
[%w(y\\\)), true],
|
65
|
+
[%w(z\\), true]]
|
66
|
+
include_examples 'expression node', infix_expression, data
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe Cucumber::TagExpressions::Or do
|
71
|
+
context '#evaluate' do
|
72
|
+
infix_expression = '\\x or y\\ or z\\'
|
73
|
+
data = [[%w(), false],
|
74
|
+
[%w(\\x), false],
|
75
|
+
[%w(y\\), false],
|
76
|
+
[%w(z\\), false],
|
77
|
+
[%w(x), true],
|
78
|
+
[%w(y), true],
|
79
|
+
[%w(z), true]]
|
80
|
+
include_examples 'expression node', infix_expression, data
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
55
84
|
end
|
data/spec/parser_spec.rb
CHANGED
@@ -9,7 +9,11 @@ describe Cucumber::TagExpressions::Parser do
|
|
9
9
|
['not a or b and not c or not d or e and f',
|
10
10
|
'( ( ( not ( a ) or ( b and not ( c ) ) ) or not ( d ) ) or ( e and f ) )'],
|
11
11
|
['not a\\(\\) or b and not c or not d or e and f',
|
12
|
-
'( ( ( not ( a\\(\\) ) or ( b and not ( c ) ) ) or not ( d ) ) or ( e and f ) )']
|
12
|
+
'( ( ( not ( a\\(\\) ) or ( b and not ( c ) ) ) or not ( d ) ) or ( e and f ) )'],
|
13
|
+
['a\\\\ and b', '( a\\\\ and b )'],
|
14
|
+
['\\a and b\\ and c\\', '( ( a and b ) and c )'],
|
15
|
+
['(a and b\\\\)', '( a and b\\\\ )'],
|
16
|
+
['a\\\\\\( and b\\\\\\)', '( a\\\\\\( and b\\\\\\) )']
|
13
17
|
]
|
14
18
|
|
15
19
|
error_test_data = [
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-tag-expressions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrea Nodari
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-10-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
version: '13.0'
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 13.0.
|
23
|
+
version: 13.0.6
|
24
24
|
type: :development
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -30,47 +30,27 @@ dependencies:
|
|
30
30
|
version: '13.0'
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 13.0.
|
33
|
+
version: 13.0.6
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: rspec
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '3.
|
40
|
+
version: '3.10'
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 3.
|
43
|
+
version: 3.10.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
46
|
version_requirements: !ruby/object:Gem::Requirement
|
47
47
|
requirements:
|
48
48
|
- - "~>"
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version: '3.
|
50
|
+
version: '3.10'
|
51
51
|
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 3.
|
54
|
-
- !ruby/object:Gem::Dependency
|
55
|
-
name: coveralls
|
56
|
-
requirement: !ruby/object:Gem::Requirement
|
57
|
-
requirements:
|
58
|
-
- - "~>"
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: '0.8'
|
61
|
-
- - ">="
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
version: 0.8.23
|
64
|
-
type: :development
|
65
|
-
prerelease: false
|
66
|
-
version_requirements: !ruby/object:Gem::Requirement
|
67
|
-
requirements:
|
68
|
-
- - "~>"
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
version: '0.8'
|
71
|
-
- - ">="
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
version: 0.8.23
|
53
|
+
version: 3.10.0
|
74
54
|
description: Cucumber tag expressions for ruby
|
75
55
|
email: cukes@googlegroups.com
|
76
56
|
executables: []
|
@@ -83,7 +63,6 @@ files:
|
|
83
63
|
- lib/cucumber/tag_expressions/expressions.rb
|
84
64
|
- lib/cucumber/tag_expressions/parser.rb
|
85
65
|
- spec/capture_warnings.rb
|
86
|
-
- spec/coverage.rb
|
87
66
|
- spec/expressions_spec.rb
|
88
67
|
- spec/parser_spec.rb
|
89
68
|
homepage: https://cucumber.io/docs/cucumber/api/#tag-expressions
|
@@ -91,10 +70,10 @@ licenses:
|
|
91
70
|
- MIT
|
92
71
|
metadata:
|
93
72
|
bug_tracker_uri: https://github.com/cucumber/cucumber/issues
|
94
|
-
changelog_uri: https://github.com/cucumber/
|
73
|
+
changelog_uri: https://github.com/cucumber/common/blob/main/tag-expressions/CHANGELOG.md
|
95
74
|
documentation_uri: https://cucumber.io/docs/cucumber/api/#tag-expressions
|
96
75
|
mailing_list_uri: https://groups.google.com/forum/#!forum/cukes
|
97
|
-
source_code_uri: https://github.com/cucumber/
|
76
|
+
source_code_uri: https://github.com/cucumber/common/blob/main/tag-expressions/ruby
|
98
77
|
post_install_message:
|
99
78
|
rdoc_options:
|
100
79
|
- "--charset=UTF-8"
|
@@ -111,13 +90,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
90
|
- !ruby/object:Gem::Version
|
112
91
|
version: '0'
|
113
92
|
requirements: []
|
114
|
-
|
115
|
-
rubygems_version: 2.7.6.2
|
93
|
+
rubygems_version: 3.1.2
|
116
94
|
signing_key:
|
117
95
|
specification_version: 4
|
118
|
-
summary: cucumber-tag-expressions-
|
96
|
+
summary: cucumber-tag-expressions-4.1.0
|
119
97
|
test_files:
|
98
|
+
- spec/expressions_spec.rb
|
120
99
|
- spec/capture_warnings.rb
|
121
100
|
- spec/parser_spec.rb
|
122
|
-
- spec/coverage.rb
|
123
|
-
- spec/expressions_spec.rb
|