blob: 84d54c5acf24a59dc421d8ed9c68c69a34f35609 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
require 'spec_helper'
describe Gitlab::Ci::Pipeline::Expression::Lexer do
let(:token_class) do
Gitlab::Ci::Pipeline::Expression::Token
end
describe '#tokenize' do
it 'tokenizes single value' do
tokens = described_class.new('$VARIABLE').tokenize
expect(tokens).to be_one
expect(tokens).to all(be_an_instance_of(token_class))
end
it 'does ignore whitespace characters' do
tokens = described_class.new("\t$VARIABLE ").tokenize
expect(tokens).to be_one
expect(tokens).to all(be_an_instance_of(token_class))
end
it 'tokenizes multiple values of the same token' do
tokens = described_class.new("$VARIABLE1 $VARIABLE2").tokenize
expect(tokens.size).to eq 2
expect(tokens).to all(be_an_instance_of(token_class))
end
end
end
|