BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
6 deletions
+17
-6
lexer.rb
lib/gitlab/ci/pipeline/expression/lexer.rb
+1
-1
statement.rb
lib/gitlab/ci/pipeline/expression/statement.rb
+1
-1
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,11 +29,22 @@ describe Gitlab::Ci::Pipeline::Expression::Statement do
end
context
'when expression grammar is correct'
do
let
(
:text
)
{
'$VAR == "value"'
}
context
'when using an operator'
do
let
(
:text
)
{
'$VAR == "value"'
}
it
'returns a reverse descent parse tree when using operator'
do
expect
(
subject
.
parse_tree
)
.
to
be_a
Gitlab
::
Ci
::
Pipeline
::
Expression
::
Equals
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
...
...
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