diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-08-28 04:50:59 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-08-28 04:50:59 +0000 |
| commit | ad32b716d82576c98e708e6dbbcec60f0372e54c (patch) | |
| tree | 1509e5afdd1e174816b8e0f2f14aba019c627b6c /test | |
| parent | db0be8e38044b8aaaf9469c5c461c84295b55732 (diff) | |
Tracking down some weird bugs that managed to creep into the parser. I expect that the main ones were a result of the If support.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1494 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
| -rw-r--r-- | test/language/parser.rb | 23 | ||||
| -rw-r--r-- | test/puppettest.rb | 4 |
2 files changed, 16 insertions, 11 deletions
diff --git a/test/language/parser.rb b/test/language/parser.rb index 4328096b5..6dd9b4bca 100644 --- a/test/language/parser.rb +++ b/test/language/parser.rb @@ -131,17 +131,17 @@ class TestParser < Test::Unit::TestCase mkdef = proc { |hash| hash.collect { |arg, value| - "%s = %s" % [arg, value] + "$%s = %s" % [arg, value] }.join(", ") } manifest = File.join(basedir, "manifest") File.open(manifest, "w") { |f| f.puts " - define method(#{mkdef.call(defs1)}, other) { + define method(#{mkdef.call(defs1)}, $other) { $variable = $testing } - define othermethod(#{mkdef.call(defs2)}, goodness) { + define othermethod(#{mkdef.call(defs2)}, $goodness) { $more = less } @@ -153,6 +153,7 @@ class TestParser < Test::Unit::TestCase goodness => rahness } " + } ast = nil @@ -248,18 +249,18 @@ class TestParser < Test::Unit::TestCase f.puts %{import "#{fullfile}"\ninclude full\nimport "local.pp"\ninclude local} end - file = tempfile() - files << file + fullmaker = tempfile() + files << fullmaker File.open(fullfile, "w") do |f| - f.puts %{class full { file { "#{file}": ensure => file }}} + f.puts %{class full { file { "#{fullmaker}": ensure => file }}} end - file = tempfile() - files << file + localmaker = tempfile() + files << localmaker File.open(localfile, "w") do |f| - f.puts %{class local { file { "#{file}": ensure => file }}} + f.puts %{class local { file { "#{localmaker}": ensure => file }}} end parser = Puppet::Parser::Parser.new @@ -490,12 +491,12 @@ file { "/tmp/yayness": str1 = %{if true { #{exec.call("true")} }} ret = nil assert_nothing_raised { - ret = parser.parse(str1) + ret = parser.parse(str1)[0] } assert_instance_of(Puppet::Parser::AST::IfStatement, ret) str2 = %{if true { #{exec.call("true")} } else { #{exec.call("false")} }} assert_nothing_raised { - ret = parser.parse(str2) + ret = parser.parse(str2)[0] } assert_instance_of(Puppet::Parser::AST::IfStatement, ret) assert_instance_of(Puppet::Parser::AST::Else, ret.else) diff --git a/test/puppettest.rb b/test/puppettest.rb index bc98a1225..d5c1e440d 100644 --- a/test/puppettest.rb +++ b/test/puppettest.rb @@ -1114,6 +1114,10 @@ module ParserTesting } assert_apply(comp) + + files.each do |file| + assert(FileTest.exists?(file), "Did not create %s" % file) + end end def mk_transobject(file = "/etc/passwd") |
