diff options
Diffstat (limited to 'spec/unit/parser/lexer_spec.rb')
-rwxr-xr-x | spec/unit/parser/lexer_spec.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/spec/unit/parser/lexer_spec.rb b/spec/unit/parser/lexer_spec.rb index 62234e214..f0f10e9f3 100755 --- a/spec/unit/parser/lexer_spec.rb +++ b/spec/unit/parser/lexer_spec.rb @@ -279,7 +279,8 @@ describe Puppet::Parser::Lexer::TOKENS[:NAME] do it "should return itself and the value if the matched term is not a keyword" do Puppet::Parser::Lexer::KEYWORDS.expects(:lookup).returns(nil) - @token.convert(stub("lexer"), "myval").should == [Puppet::Parser::Lexer::TOKENS[:NAME], "myval"] + lexer = stub("lexer") + @token.convert(lexer, "myval").should == [Puppet::Parser::Lexer::TOKENS[:NAME], "myval"] end it "should return the keyword token and the value if the matched term is a keyword" do @@ -845,6 +846,14 @@ describe "Puppet::Parser::Lexer in the old tests" do end end +describe 'Puppet::Parser::Lexer handles reserved words' do + ['function', 'private', 'attr', 'type'].each do |reserved_bare_word| + it "by delivering '#{reserved_bare_word}' as a bare word" do + expect(tokens_scanned_from(reserved_bare_word)).to eq([[:NAME, {:value=>reserved_bare_word, :line => 1}]]) + end + end +end + describe "Puppet::Parser::Lexer in the old tests when lexing example files" do my_fixtures('*.pp') do |file| it "should correctly lex #{file}" do |