summaryrefslogtreecommitdiff
path: root/spec/unit/parser/lexer_spec.rb
diff options
context:
space:
mode:
authorStig Sandbeck Mathisen <ssm@debian.org>2014-09-07 10:14:36 +0200
committerStig Sandbeck Mathisen <ssm@debian.org>2014-09-07 10:14:36 +0200
commitd4b83be375ac1dead058e091191ee7c7b7c24c8a (patch)
treedc825687392ae3068de5b764be60c53122d9e02a /spec/unit/parser/lexer_spec.rb
parent229cbb976fe0f70f5f30548b83517b415840f9bb (diff)
parent1681684857c6e39d60d87b0b3520d8783977ceff (diff)
downloadpuppet-upstream/3.7.0.tar.gz
Imported Upstream version 3.7.0upstream/3.7.0
Diffstat (limited to 'spec/unit/parser/lexer_spec.rb')
-rwxr-xr-xspec/unit/parser/lexer_spec.rb11
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