diff options
author | Luke Kanies <luke@reductivelabs.com> | 2010-01-30 23:36:32 -0600 |
---|---|---|
committer | test branch <puppet-dev@googlegroups.com> | 2010-02-17 06:50:53 -0800 |
commit | 9c867e6d79dcc56cd34683c9a339dc729ad2d291 (patch) | |
tree | 27ee2a51648d11891a5168db1e63e064244eeef5 /test/language | |
parent | 274d1c5e78250640b8d2c40201ca2586c0088f32 (diff) | |
download | puppet-9c867e6d79dcc56cd34683c9a339dc729ad2d291.tar.gz puppet-9c867e6d79dcc56cd34683c9a339dc729ad2d291.tar.xz puppet-9c867e6d79dcc56cd34683c9a339dc729ad2d291.zip |
Fixing most of the broken tests in test/
This involves a bit of refactoring in the rest
of the code to make it all work, but most of the
changes are fixing or removing old tests.
Signed-off-by: Luke Kanies <luke@reductivelabs.com>
Diffstat (limited to 'test/language')
-rwxr-xr-x | test/language/ast.rb | 2 | ||||
-rwxr-xr-x | test/language/ast/resource.rb | 58 | ||||
-rwxr-xr-x | test/language/ast/resource_reference.rb | 2 | ||||
-rwxr-xr-x | test/language/ast/variable.rb | 3 | ||||
-rwxr-xr-x | test/language/snippets.rb | 4 |
5 files changed, 3 insertions, 66 deletions
diff --git a/test/language/ast.rb b/test/language/ast.rb index 209bc9863..916c34d45 100755 --- a/test/language/ast.rb +++ b/test/language/ast.rb @@ -56,7 +56,7 @@ class TestAST < Test::Unit::TestCase ref = resourceoverride("file", "/yayness", "owner" => "blah", "group" => "boo") end - Puppet::Parser::Resource.expects(:new).with { |o| o.is_a?(Hash) }.returns(:override) + Puppet::Parser::Resource.expects(:new).with { |type, title, o| o.is_a?(Hash) }.returns(:override) scope.compiler.expects(:add_override).with(:override) ret = nil assert_nothing_raised do diff --git a/test/language/ast/resource.rb b/test/language/ast/resource.rb deleted file mode 100755 index 4124655ca..000000000 --- a/test/language/ast/resource.rb +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env ruby -# -# Created by Luke A. Kanies on 2007-07-8. -# Copyright (c) 2007. All rights reserved. - -require File.dirname(__FILE__) + '/../../lib/puppettest' - -require 'puppettest' -require 'puppettest/parsertesting' - -class TestASTResource< Test::Unit::TestCase - include PuppetTest - include PuppetTest::ParserTesting - AST = Puppet::Parser::AST - - def setup - super - @scope = mkscope - @parser = @scope.compiler.parser - end - - def newdef(type, title, params = nil) - params ||= AST::ASTArray.new(:children => []) - AST::Resource.new(:type => type, :title => AST::String.new(:value => title), :params => params) - end - - # Related to #806, make sure resources always look up the full path to the resource. - def test_scoped_types - @parser.newdefine "one" - @parser.newdefine "one::two" - @parser.newdefine "three" - twoscope = @scope.newscope(:namespace => "one") - twoscope.resource = @scope.resource - assert(twoscope.find_definition("two"), "Could not find 'two' definition") - title = "title" - - # First try a qualified type - assert_equal("One::Two", newdef("two", title).evaluate(twoscope)[0].type, - "Defined type was not made fully qualified") - - # Then try a type that does not need to be qualified - assert_equal("One", newdef("one", title).evaluate(twoscope)[0].type, - "Unqualified defined type was not handled correctly") - - # Then an unqualified type from within the one namespace - assert_equal("Three", newdef("three", title).evaluate(twoscope)[0].type, - "Defined type was not made fully qualified") - - # Then a builtin type - assert_equal("File", newdef("file", title).evaluate(twoscope)[0].type, - "Builtin type was not handled correctly") - - # Now try a type that does not exist, which should throw an error. - assert_raise(Puppet::ParseError, "Did not fail on a missing type in a resource reference") do - newdef("nosuchtype", title).evaluate(twoscope) - end - end -end diff --git a/test/language/ast/resource_reference.rb b/test/language/ast/resource_reference.rb index 325dd2118..5abb0d6e5 100755 --- a/test/language/ast/resource_reference.rb +++ b/test/language/ast/resource_reference.rb @@ -20,7 +20,7 @@ class TestASTResourceReference < Test::Unit::TestCase def setup super @scope = mkscope - @parser = @scope.compiler.parser + @parser = Puppet::Parser::Parser.new(Puppet::Node::Environment.new) end # Related to #706, make sure resource references correctly translate to qualified types. diff --git a/test/language/ast/variable.rb b/test/language/ast/variable.rb index 49b1dbbc2..6a8b028bd 100755 --- a/test/language/ast/variable.rb +++ b/test/language/ast/variable.rb @@ -15,8 +15,7 @@ class TestVariable < Test::Unit::TestCase def setup super - @interp = mkinterp - @scope = mkscope :interp => @interp + @scope = mkscope @name = "myvar" @var = AST::Variable.new(:value => @name) end diff --git a/test/language/snippets.rb b/test/language/snippets.rb index bd0d34872..6aa202640 100755 --- a/test/language/snippets.rb +++ b/test/language/snippets.rb @@ -74,10 +74,6 @@ class TestSnippets < Test::Unit::TestCase end def ast2scope(ast) - interp = Puppet::Parser::Interpreter.new( - :ast => ast, - :client => client() - ) scope = Puppet::Parser::Scope.new() ast.evaluate(scope) |