spec/front_end/scanner_spec.rb in loxxy-0.2.04 vs spec/front_end/scanner_spec.rb in loxxy-0.2.05
- old
+ new
@@ -215,9 +215,16 @@
expect(token_nil).to be_kind_of(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
+
+ it 'should differentiate nil from variable spelled same' do
+ subject.start_with('Nil')
+ similar = subject.tokens[0]
+ expect(similar.terminal).to eq('IDENTIFIER')
+ expect(similar.lexeme).to eq('Nil')
+ end
end # context
context 'Handling comments:' do
it 'should cope with one line comment only' do
subject.start_with('// comment')