Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
64e86dab
Commit
64e86dab
authored
7 years ago
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow using an empty string with pipeline expressions
parent
8a7c89ad
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
lib/gitlab/ci/pipeline/expression/lexeme/string.rb
lib/gitlab/ci/pipeline/expression/lexeme/string.rb
+1
-1
spec/lib/gitlab/ci/pipeline/expression/lexeme/string_spec.rb
spec/lib/gitlab/ci/pipeline/expression/lexeme/string_spec.rb
+16
-0
No files found.
lib/gitlab/ci/pipeline/expression/lexeme/string.rb
View file @
64e86dab
...
...
@@ -4,7 +4,7 @@ module Gitlab
module
Expression
module
Lexeme
class
String
<
Lexeme
::
Value
PATTERN
=
/("(?<string>.
+?)")|('(?<string>.+
?)')/
.
freeze
PATTERN
=
/("(?<string>.
*?)")|('(?<string>.*
?)')/
.
freeze
def
initialize
(
value
)
@value
=
value
...
...
This diff is collapsed.
Click to expand it.
spec/lib/gitlab/ci/pipeline/expression/lexeme/string_spec.rb
View file @
64e86dab
...
...
@@ -73,6 +73,22 @@ describe Gitlab::Ci::Pipeline::Expression::Lexeme::String do
expect
(
token
).
not_to
be_nil
expect
(
token
.
build
.
evaluate
).
to
eq
'some " string'
end
it
'allows to use an empty string inside single quotes'
do
scanner
=
StringScanner
.
new
(
%('')
)
token
=
described_class
.
scan
(
scanner
)
expect
(
token
.
build
.
evaluate
).
to
eq
''
end
it
'allow to use an empty string inside double quotes'
do
scanner
=
StringScanner
.
new
(
%("")
)
token
=
described_class
.
scan
(
scanner
)
expect
(
token
.
build
.
evaluate
).
to
eq
''
end
end
end
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment