diff options
author | Luke Kanies <luke@madstop.com> | 2008-08-18 11:47:40 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-08-18 11:47:40 -0500 |
commit | e3971b9751141cd448a8197da024be43581f6dcd (patch) | |
tree | 3ae780db3d9dae0a4df10ec24f928bf3a844e749 /spec/unit/parser | |
parent | 025edc5c3737f476119df4bab73ebdc68be19430 (diff) | |
parent | 2ec4e298c3274abc8eaad4230bca8d39a48d2e35 (diff) | |
download | puppet-e3971b9751141cd448a8197da024be43581f6dcd.tar.gz puppet-e3971b9751141cd448a8197da024be43581f6dcd.tar.xz puppet-e3971b9751141cd448a8197da024be43581f6dcd.zip |
Merge branch '0.24.x'
Conflicts:
CHANGELOG
test/util/posixtest.rb
Diffstat (limited to 'spec/unit/parser')
-rwxr-xr-x | spec/unit/parser/lexer.rb | 9 | ||||
-rwxr-xr-x | spec/unit/parser/templatewrapper.rb | 13 |
2 files changed, 21 insertions, 1 deletions
diff --git a/spec/unit/parser/lexer.rb b/spec/unit/parser/lexer.rb index 9972f7268..fb666054d 100755 --- a/spec/unit/parser/lexer.rb +++ b/spec/unit/parser/lexer.rb @@ -378,6 +378,15 @@ describe "Puppet::Parser::Lexer in the old tests" do } end + it "should correctly parse names with numerals" do + string = %w{1name name1 11names names11} + + string.each { |t| + @lexer.string = t + @lexer.fullscan.should == [[:NAME,t],[false,false]] + } + end + it "should correctly parse empty strings" do bit = '$var = ""' diff --git a/spec/unit/parser/templatewrapper.rb b/spec/unit/parser/templatewrapper.rb index 40465f955..2d4bd141b 100755 --- a/spec/unit/parser/templatewrapper.rb +++ b/spec/unit/parser/templatewrapper.rb @@ -6,7 +6,7 @@ describe Puppet::Parser::TemplateWrapper do before(:each) do compiler = stub('compiler', :environment => "foo") parser = stub('parser', :watch_file => true) - @scope = stub('scope', :compiler => compiler, :parser => parser) + @scope = stub('scope', :compiler => compiler, :parser => parser, :to_hash => {}) @file = "fake_template" Puppet::Module.stubs(:find_template).returns("/tmp/fake_template") FileTest.stubs(:exists?).returns("true") @@ -54,4 +54,15 @@ describe Puppet::Parser::TemplateWrapper do tw = Puppet::Parser::TemplateWrapper.new(@scope, @file) tw.has_variable?("chicken").should eql(false) end + + it "should set all of the scope's variables as instance variables" do + template_mock = mock("template", :result => "woot!") + File.expects(:read).with("/tmp/fake_template").returns("template contents") + ERB.expects(:new).with("template contents", 0, "-").returns(template_mock) + + @scope.expects(:to_hash).returns("one" => "foo") + @tw.result + + @tw.instance_variable_get("@one").should == "foo" + end end |