BigW Consortium Gitlab

Commit 35354826 by Grzegorz Bizon

Improve pipeline expressions specs and freeze constants

parent e6498efe
......@@ -7,7 +7,7 @@ module Gitlab
Expression::Variable,
Expression::String,
Expression::Equals
]
].freeze
MAX_CYCLES = 5
SyntaxError = Class.new(StandardError)
......
......@@ -12,7 +12,7 @@ module Gitlab
%w[string equals variable],
%w[null equals variable],
%w[variable]
]
].freeze
def initialize(statement, pipeline)
@pipeline = pipeline
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment