spec/front_end/scanner_spec.rb in loxxy-0.4.04 vs spec/front_end/scanner_spec.rb in loxxy-0.4.05
- old
+ new
@@ -103,21 +103,21 @@
end
it 'should recognize a false boolean token' do
subject.start_with('false')
token_false = subject.tokens[0]
- expect(token_false).to be_kind_of(Literal)
+ expect(token_false).to be_kind_of(Rley::Lexical::Literal)
expect(token_false.terminal).to eq('FALSE')
expect(token_false.lexeme).to eq('false')
expect(token_false.value).to be_kind_of(Datatype::False)
expect(token_false.value.value).to be_falsy
end
it 'should recognize a true boolean token' do
subject.start_with('true')
token_true = subject.tokens[0]
- expect(token_true).to be_kind_of(Literal)
+ expect(token_true).to be_kind_of(Rley::Lexical::Literal)
expect(token_true.terminal).to eq('TRUE')
expect(token_true.lexeme).to eq('true')
expect(token_true.value).to be_kind_of(Datatype::True)
expect(token_true.value.value).to be_truthy
end
@@ -135,11 +135,11 @@
['123.456', 123.456]
]
subject.start_with(input)
subject.tokens[0..-2].each_with_index do |tok, i|
- expect(tok).to be_kind_of(Literal)
+ expect(tok).to be_kind_of(Rley::Lexical::Literal)
expect(tok.terminal).to eq('NUMBER')
(lexeme, val) = expectations[i]
expect(tok.lexeme).to eq(lexeme)
expect(tok.value).to be_kind_of(Datatype::Number)
expect(tok.value.value).to eq(val)
@@ -175,14 +175,14 @@
subject.start_with(input)
tokens = subject.tokens[0..-2]
expect(tokens[0]).to be_kind_of(Rley::Lexical::Token)
expect(tokens[0].terminal).to eq('DOT')
- expect(tokens[1]).to be_kind_of(Literal)
+ expect(tokens[1]).to be_kind_of(Rley::Lexical::Literal)
expect(tokens[1].terminal).to eq('NUMBER')
expect(tokens[1].value.value).to eq(456)
- expect(tokens[2]).to be_kind_of(Literal)
+ expect(tokens[2]).to be_kind_of(Rley::Lexical::Literal)
expect(tokens[2].terminal).to eq('NUMBER')
expect(tokens[2].value.value).to eq(123)
expect(tokens[3]).to be_kind_of(Rley::Lexical::Token)
expect(tokens[3].terminal).to eq('DOT')
end
@@ -200,11 +200,11 @@
'123'
]
subject.start_with(input)
subject.tokens[0..-2].each_with_index do |str, i|
- expect(str).to be_kind_of(Literal)
+ expect(str).to be_kind_of(Rley::Lexical::Literal)
expect(str.terminal).to eq('STRING')
val = expectations[i]
expect(str.value).to be_kind_of(Datatype::LXString)
expect(str.value.value).to eq(val)
end
@@ -234,10 +234,10 @@
# rubocop: enable Style/StringConcatenation
it 'should recognize a nil token' do
subject.start_with('nil')
token_nil = subject.tokens[0]
- expect(token_nil).to be_kind_of(Literal)
+ expect(token_nil).to be_kind_of(Rley::Lexical::Literal)
expect(token_nil.terminal).to eq('NIL')
expect(token_nil.lexeme).to eq('nil')
expect(token_nil.value).to be_kind_of(Datatype::Nil)
end