diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-02-21 12:51:56 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-02-21 12:51:56 +0100 |
commit | cee3be29ec4a2b31c7e67cd66a36a5c95e8f3b05 (patch) | |
tree | 3f5d0ff90330fe04a2e5ed55071254ff402cb3c5 /spec/lib/gitlab | |
parent | 9954928cceb2a5de7788ffdfdeb8a99e9ccf8b08 (diff) | |
download | gitlab-ce-cee3be29ec4a2b31c7e67cd66a36a5c95e8f3b05.tar.gz |
Add a lexeme for a string pipeline expression
Diffstat (limited to 'spec/lib/gitlab')
-rw-r--r-- | spec/lib/gitlab/ci/pipeline/expression/lexer_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/pipeline/expression/lexer_spec.rb b/spec/lib/gitlab/ci/pipeline/expression/lexer_spec.rb index 84d54c5acf2..d0a616d5c2f 100644 --- a/spec/lib/gitlab/ci/pipeline/expression/lexer_spec.rb +++ b/spec/lib/gitlab/ci/pipeline/expression/lexer_spec.rb @@ -26,5 +26,21 @@ describe Gitlab::Ci::Pipeline::Expression::Lexer do expect(tokens.size).to eq 2 expect(tokens).to all(be_an_instance_of(token_class)) end + + it 'tokenizes multiple values with different tokens' do + tokens = described_class.new('$VARIABLE "text" "value"').tokenize + + expect(tokens.size).to eq 3 + expect(tokens.first.value).to eq '$VARIABLE' + expect(tokens.second.value).to eq '"text"' + expect(tokens.third.value).to eq '"value"' + end + + it 'limits statement to 5 tokens' do + lexer = described_class.new("$V1 $V2 $V3 $V4 $V5 $V6") + + expect { lexer.tokenize } + .to raise_error described_class::SyntaxError + end end end |