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
Léo-Paul Géneau
gitlab-ce
Commits
35354826
Commit
35354826
authored
Feb 21, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve pipeline expressions specs and freeze constants
parent
e6498efe
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
6 deletions
+17
-6
lib/gitlab/ci/pipeline/expression/lexer.rb
lib/gitlab/ci/pipeline/expression/lexer.rb
+1
-1
lib/gitlab/ci/pipeline/expression/statement.rb
lib/gitlab/ci/pipeline/expression/statement.rb
+1
-1
spec/lib/gitlab/ci/pipeline/expression/statement_spec.rb
spec/lib/gitlab/ci/pipeline/expression/statement_spec.rb
+15
-4
No files found.
lib/gitlab/ci/pipeline/expression/lexer.rb
View file @
35354826
...
...
@@ -7,7 +7,7 @@ module Gitlab
Expression
::
Variable
,
Expression
::
String
,
Expression
::
Equals
]
]
.
freeze
MAX_CYCLES
=
5
SyntaxError
=
Class
.
new
(
StandardError
)
...
...
lib/gitlab/ci/pipeline/expression/statement.rb
View file @
35354826
...
...
@@ -12,7 +12,7 @@ module Gitlab
%w[string equals variable]
,
%w[null equals variable]
,
%w[variable]
]
]
.
freeze
def
initialize
(
statement
,
pipeline
)
@pipeline
=
pipeline
...
...
spec/lib/gitlab/ci/pipeline/expression/statement_spec.rb
View file @
35354826
...
...
@@ -29,12 +29,23 @@ describe Gitlab::Ci::Pipeline::Expression::Statement do
end
context
'when expression grammar is correct'
do
context
'when using an operator'
do
let
(
:text
)
{
'$VAR == "value"'
}
it
'returns a reverse descent parse tree when using operator
'
do
it
'returns a reverse descent parse tree
'
do
expect
(
subject
.
parse_tree
)
.
to
be_a
Gitlab
::
Ci
::
Pipeline
::
Expression
::
Equals
end
end
context
'when using a single token'
do
let
(
:text
)
{
'$VARIABLE'
}
it
'returns a single token instance'
do
expect
(
subject
.
parse_tree
)
.
to
be_a
Gitlab
::
Ci
::
Pipeline
::
Expression
::
Variable
end
end
end
end
end
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