summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/language/ast.rb16
-rwxr-xr-xtest/language/ast/casestatement.rb6
-rwxr-xr-xtest/language/ast/definition.rb8
-rwxr-xr-xtest/language/ast/hostclass.rb14
-rwxr-xr-xtest/language/ast/resource.rb10
-rwxr-xr-xtest/language/ast/resource_reference.rb22
-rwxr-xr-xtest/language/ast/selector.rb4
-rwxr-xr-xtest/language/ast/variable.rb4
-rwxr-xr-xtest/language/functions.rb22
-rwxr-xr-xtest/language/parser.rb12
-rwxr-xr-xtest/language/resource.rb3
-rwxr-xr-xtest/language/scope.rb4
12 files changed, 62 insertions, 63 deletions
diff --git a/test/language/ast.rb b/test/language/ast.rb
index b31012d38..72a3ee90c 100755
--- a/test/language/ast.rb
+++ b/test/language/ast.rb
@@ -35,14 +35,14 @@ class TestAST < Test::Unit::TestCase
# We initialized it to true, so we should get that first
ret = nil
assert_nothing_raised {
- ret = astif.evaluate(:scope => "yay")
+ ret = astif.evaluate("yay")
}
assert_equal(:if, ret)
# Now set it to false and check that
faketest.evaluate = false
assert_nothing_raised {
- ret = astif.evaluate(:scope => "yay")
+ ret = astif.evaluate("yay")
}
assert_equal(:else, ret)
end
@@ -60,7 +60,7 @@ class TestAST < Test::Unit::TestCase
scope.compile.expects(:store_override).with(:override)
ret = nil
assert_nothing_raised do
- ret = ref.evaluate :scope => scope
+ ret = ref.evaluate scope
end
assert_equal(:override, ret, "Did not return override")
@@ -74,7 +74,7 @@ class TestAST < Test::Unit::TestCase
args = {:source => "/yay/ness", :group => "yayness"}
assert_nothing_raised do
obj = defaultobj "file", args
- obj.evaluate :scope => scope
+ obj.evaluate scope
end
hash = nil
@@ -119,7 +119,7 @@ class TestAST < Test::Unit::TestCase
# Now try evaluating the node
assert_nothing_raised do
- mynode.evaluate :scope => scope, :resource => scope.resource
+ mynode.evaluate scope, scope.resource
end
# Make sure that we can find each of the files
@@ -136,7 +136,7 @@ class TestAST < Test::Unit::TestCase
newscope = mkscope :parser => parser
assert_nothing_raised do
- child.evaluate :scope => newscope, :resource => scope.resource
+ child.evaluate newscope, scope.resource
end
assert(newscope.findresource("File[/tmp/base]"),
@@ -155,7 +155,7 @@ class TestAST < Test::Unit::TestCase
ret = nil
assert_nothing_raised do
- ret = coll.evaluate :scope => scope
+ ret = coll.evaluate scope
end
assert_instance_of(Puppet::Parser::Collector, ret)
@@ -175,7 +175,7 @@ class TestAST < Test::Unit::TestCase
run_collection_queries(:virtual) do |string, result, query|
code = nil
assert_nothing_raised do
- str, code = query.evaluate :scope => scope
+ str, code = query.evaluate scope
end
assert_instance_of(Proc, code)
diff --git a/test/language/ast/casestatement.rb b/test/language/ast/casestatement.rb
index 0a744b686..d95d788d9 100755
--- a/test/language/ast/casestatement.rb
+++ b/test/language/ast/casestatement.rb
@@ -45,7 +45,7 @@ class TestCaseStatement < Test::Unit::TestCase
result = nil
assert_nothing_raised do
- result = ast.evaluate :scope => scope
+ result = ast.evaluate scope
end
assert(result, "did not get valid result")
assert_equal(["upper"], $evaluated, "Did not match case-sensitively")
@@ -56,7 +56,7 @@ class TestCaseStatement < Test::Unit::TestCase
$evaluated.clear
hash["MyParam"].reset
assert_nothing_raised do
- result = ast.evaluate :scope => scope
+ result = ast.evaluate scope
end
assert(result, "did not get valid result")
assert_equal(["lower"], result, "Did not match case-insensitively")
@@ -92,7 +92,7 @@ class TestCaseStatement < Test::Unit::TestCase
scope = mkscope
scope.setvar("testparam", value)
assert_nothing_raised do
- result = ast.evaluate(:scope => scope)
+ result = ast.evaluate(scope)
end
assert_equal(should, result, "Got incorrect result for %s" % value)
diff --git a/test/language/ast/definition.rb b/test/language/ast/definition.rb
index 2a71aaa45..5f415eb41 100755
--- a/test/language/ast/definition.rb
+++ b/test/language/ast/definition.rb
@@ -63,7 +63,7 @@ class TestASTDefinition < Test::Unit::TestCase
resource.stubs(:title)
assert_nothing_raised do
- klass.evaluate(:scope => scope, :resource => resource)
+ klass.evaluate(scope, resource)
end
firstobj = config.findresource("File[/tmp/first]")
@@ -76,7 +76,7 @@ class TestASTDefinition < Test::Unit::TestCase
# Make sure we can't evaluate it with the same args
assert_raise(Puppet::ParseError) do
- klass.evaluate(:scope => scope, :resource => resource)
+ klass.evaluate(scope, resource)
end
# Now create another with different args
@@ -93,7 +93,7 @@ class TestASTDefinition < Test::Unit::TestCase
resource2.send(:set_parameter, "owner", "daemon")
assert_nothing_raised do
- klass.evaluate(:scope => scope, :resource => resource2)
+ klass.evaluate(scope, resource2)
end
secondobj = config.findresource("File[/tmp/second]")
@@ -136,7 +136,7 @@ class TestASTDefinition < Test::Unit::TestCase
end
assert_nothing_raised("Could not evaluate definition with %s" % hash.inspect) do
- klass.evaluate(:scope => scope, :resource => resource)
+ klass.evaluate(scope, resource)
end
name = hash[:name] || hash[:title]
diff --git a/test/language/ast/hostclass.rb b/test/language/ast/hostclass.rb
index 80032f30c..abc5e05be 100755
--- a/test/language/ast/hostclass.rb
+++ b/test/language/ast/hostclass.rb
@@ -29,12 +29,12 @@ class TestASTHostClass < Test::Unit::TestCase
resource = Puppet::Parser::Resource.new(:type => "class", :title => "first", :scope => scope)
assert_nothing_raised do
- klass.evaluate(:scope => scope, :resource => resource)
+ klass.evaluate(scope, resource)
end
# Then try it again
assert_nothing_raised do
- klass.evaluate(:scope => scope, :resource => resource)
+ klass.evaluate(scope, resource)
end
assert(scope.compile.class_scope(klass), "Class was not considered evaluated")
@@ -70,11 +70,11 @@ class TestASTHostClass < Test::Unit::TestCase
)
assert_nothing_raised do
- newsub.evaluate(:scope => scope, :resource => resource)
+ newsub.evaluate(scope, resource)
end
assert_nothing_raised do
- moresub.evaluate(:scope => scope, :resource => resource)
+ moresub.evaluate(scope, resource)
end
assert(scope.compile.class_scope(newbase), "Did not eval newbase")
@@ -174,11 +174,11 @@ class TestASTHostClass < Test::Unit::TestCase
base = parser.newclass "base"
sub = parser.newclass "sub", :parent => "base"
- base.expects(:safeevaluate).with do |args|
+ base.expects(:safeevaluate).with do |*args|
assert(scope.compile.catalog.tags.include?("sub"), "Did not tag with sub class name before evaluating base class")
- base.evaluate(args)
+ base.evaluate(*args)
true
end
- sub.evaluate :scope => scope, :resource => scope.resource
+ sub.evaluate scope, scope.resource
end
end
diff --git a/test/language/ast/resource.rb b/test/language/ast/resource.rb
index c99d98eeb..ef7800066 100755
--- a/test/language/ast/resource.rb
+++ b/test/language/ast/resource.rb
@@ -36,24 +36,24 @@ class TestASTResource< Test::Unit::TestCase
title = "title"
# First try a qualified type
- assert_equal("One::Two", newdef("two", title).evaluate(:scope => twoscope)[0].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(:scope => twoscope)[0].type,
+ 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(:scope => twoscope)[0].type,
+ 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(:scope => twoscope)[0].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(:scope => twoscope)
+ 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 c9fde078f..9de3391d9 100755
--- a/test/language/ast/resource_reference.rb
+++ b/test/language/ast/resource_reference.rb
@@ -31,7 +31,7 @@ class TestASTResourceReference < Test::Unit::TestCase
evaled = nil
assert_nothing_raised("Could not evaluate resource ref") do
- evaled = ref.evaluate(:scope => @scope)
+ evaled = ref.evaluate(@scope)
end
assert_equal(type, evaled.type, "Type did not translate correctly")
@@ -44,7 +44,7 @@ class TestASTResourceReference < Test::Unit::TestCase
ref = newref("Class", "one")
evaled = nil
assert_nothing_raised("Could not evaluate resource ref") do
- evaled = ref.evaluate(:scope => @scope)
+ evaled = ref.evaluate(@scope)
end
assert_equal("Class", evaled.type, "Did not set type to 'class'")
@@ -61,24 +61,24 @@ class TestASTResourceReference < Test::Unit::TestCase
title = "title"
# First try a qualified type
- assert_equal("One::Two", newref("two", title).evaluate(:scope => twoscope).type,
+ assert_equal("One::Two", newref("two", title).evaluate(twoscope).type,
"Defined type was not made fully qualified")
# Then try a type that does not need to be qualified
- assert_equal("One", newref("one", title).evaluate(:scope => twoscope).type,
+ assert_equal("One", newref("one", title).evaluate(twoscope).type,
"Unqualified defined type was not handled correctly")
# Then an unqualified type from within the one namespace
- assert_equal("Three", newref("three", title).evaluate(:scope => twoscope).type,
+ assert_equal("Three", newref("three", title).evaluate(twoscope).type,
"Defined type was not made fully qualified")
# Then a builtin type
- assert_equal("File", newref("file", title).evaluate(:scope => twoscope).type,
+ assert_equal("File", newref("file", title).evaluate(twoscope).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
- newref("nosuchtype", title).evaluate(:scope => twoscope)
+ newref("nosuchtype", title).evaluate(twoscope)
end
# Now run the same tests, but with the classes
@@ -86,20 +86,20 @@ class TestASTResourceReference < Test::Unit::TestCase
@parser.newclass "one::five"
# First try an unqualified type
- assert_equal("four", newref("class", "four").evaluate(:scope => twoscope).title,
+ assert_equal("four", newref("class", "four").evaluate(twoscope).title,
"Unqualified class was not found")
# Then a qualified class
- assert_equal("one::five", newref("class", "five").evaluate(:scope => twoscope).title,
+ assert_equal("one::five", newref("class", "five").evaluate(twoscope).title,
"Class was not made fully qualified")
# Then try a type that does not need to be qualified
- assert_equal("four", newref("class", "four").evaluate(:scope => twoscope).title,
+ assert_equal("four", newref("class", "four").evaluate(twoscope).title,
"Unqualified class 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
- newref("class", "nosuchclass").evaluate(:scope => twoscope)
+ newref("class", "nosuchclass").evaluate(twoscope)
end
end
end
diff --git a/test/language/ast/selector.rb b/test/language/ast/selector.rb
index 535fcbf70..6e923bdcb 100755
--- a/test/language/ast/selector.rb
+++ b/test/language/ast/selector.rb
@@ -37,7 +37,7 @@ class TestSelector < Test::Unit::TestCase
params = maker.call()
sel = AST::Selector.new(:param => param, :values => params.values)
result = nil
- assert_nothing_raised { result = sel.evaluate(:scope => scope) }
+ assert_nothing_raised { result = sel.evaluate(scope) }
assert_equal(should[str], result, "did not case-sensitively match %s" % str)
end
@@ -53,7 +53,7 @@ class TestSelector < Test::Unit::TestCase
params.delete(:upper)
sel = AST::Selector.new(:param => param, :values => params.values)
result = nil
- assert_nothing_raised { result = sel.evaluate(:scope => scope) }
+ assert_nothing_raised { result = sel.evaluate(scope) }
assert_equal("lower", result, "did not case-insensitively match %s" % str)
end
end
diff --git a/test/language/ast/variable.rb b/test/language/ast/variable.rb
index 09122ce16..bde397bb4 100755
--- a/test/language/ast/variable.rb
+++ b/test/language/ast/variable.rb
@@ -22,9 +22,9 @@ class TestVariable < Test::Unit::TestCase
end
def test_evaluate
- assert_equal("", @var.evaluate(:scope => @scope), "did not return empty string on unset var")
+ assert_equal("", @var.evaluate(@scope), "did not return empty string on unset var")
@scope.setvar(@name, "something")
- assert_equal("something", @var.evaluate(:scope => @scope), "incorrect variable value")
+ assert_equal("something", @var.evaluate(@scope), "incorrect variable value")
end
end
diff --git a/test/language/functions.rb b/test/language/functions.rb
index 132ee97ac..edb39e9a7 100755
--- a/test/language/functions.rb
+++ b/test/language/functions.rb
@@ -41,7 +41,7 @@ class TestLangFunctions < Test::Unit::TestCase
scope = mkscope
val = nil
assert_nothing_raised do
- val = func.evaluate(:scope => scope)
+ val = func.evaluate(scope)
end
assert_equal("output avalue", val)
@@ -57,7 +57,7 @@ class TestLangFunctions < Test::Unit::TestCase
val = nil
assert_nothing_raised do
- val = func.evaluate(:scope => scope)
+ val = func.evaluate(scope)
end
assert_equal(retval, val, "'tagged' returned %s for %s" % [val, tag])
@@ -86,7 +86,7 @@ class TestLangFunctions < Test::Unit::TestCase
scope = mkscope
val = nil
assert_raise(Puppet::ParseError) do
- val = func.evaluate(:scope => scope)
+ val = func.evaluate(scope)
end
end
@@ -117,16 +117,16 @@ class TestLangFunctions < Test::Unit::TestCase
scope = mkscope
assert_raise(Puppet::ParseError) do
- ast.evaluate(:scope => scope)
+ ast.evaluate(scope)
end
scope.setvar("one", "One")
assert_raise(Puppet::ParseError) do
- ast.evaluate(:scope => scope)
+ ast.evaluate(scope)
end
scope.setvar("two", "Two")
assert_nothing_raised do
- ast.evaluate(:scope => scope)
+ ast.evaluate(scope)
end
assert_equal("template One\ntemplate Two\n", scope.lookupvar("output"),
@@ -155,13 +155,13 @@ class TestLangFunctions < Test::Unit::TestCase
scope = mkscope
assert_raise(Puppet::ParseError) do
- ast.evaluate(:scope => scope)
+ ast.evaluate(scope)
end
scope.setvar("yayness", "this is yayness")
assert_nothing_raised do
- ast.evaluate(:scope => scope)
+ ast.evaluate(scope)
end
assert_equal("template this is yayness\n", scope.lookupvar("output"),
@@ -191,7 +191,7 @@ class TestLangFunctions < Test::Unit::TestCase
scope = mkscope
scope.setvar("myvar", "this is yayness")
assert_raise(Puppet::ParseError) do
- ast.evaluate(:scope => scope)
+ ast.evaluate(scope)
end
end
@@ -264,14 +264,14 @@ class TestLangFunctions < Test::Unit::TestCase
}.each do |string, value|
scope = mkscope
assert_raise(Puppet::ParseError) do
- ast.evaluate(:scope => scope)
+ ast.evaluate(scope)
end
scope.setvar("yayness", string)
assert_equal(string, scope.lookupvar("yayness", false))
assert_nothing_raised("An empty string was not a valid variable value") do
- ast.evaluate(:scope => scope)
+ ast.evaluate(scope)
end
assert_equal("template #{value}\n", scope.lookupvar("output"),
diff --git a/test/language/parser.rb b/test/language/parser.rb
index 1bbd894e4..3df4d0bb8 100755
--- a/test/language/parser.rb
+++ b/test/language/parser.rb
@@ -47,7 +47,7 @@ class TestParser < Test::Unit::TestCase
ast = parser.parse
config = mkcompile(parser)
config.compile
- #ast.classes[""].evaluate :scope => config.topscope
+ #ast.classes[""].evaluate config.topscope
}
Puppet::Type.allclear
}
@@ -891,7 +891,7 @@ file { "/tmp/yayness":
assert(parser.classes["myclass"], "Could not find definition")
assert_equal("myclass", parser.classes["myclass"].classname)
assert_equal(%w{original code},
- parser.classes["myclass"].code.evaluate(:scope => scope))
+ parser.classes["myclass"].code.evaluate(scope))
# Newclass behaves differently than the others -- it just appends
# the code to the existing class.
@@ -901,7 +901,7 @@ file { "/tmp/yayness":
end
assert(klass, "Did not return class when appending")
assert_equal(%w{original code something new},
- parser.classes["myclass"].code.evaluate(:scope => scope))
+ parser.classes["myclass"].code.evaluate(scope))
# Now create the same class name in a different scope
assert_nothing_raised {
@@ -914,7 +914,7 @@ file { "/tmp/yayness":
assert_equal("other::myclass", other.classname)
assert_equal("other::myclass", other.namespace)
assert_equal(%w{something diff},
- other.code.evaluate(:scope => scope))
+ other.code.evaluate(scope))
# Make sure newclass deals correctly with nodes with no code
klass = parser.newclass("nocode")
@@ -925,7 +925,7 @@ file { "/tmp/yayness":
end
assert(klass, "Did not return class with no code")
assert_equal(%w{yay test},
- parser.classes["nocode"].code.evaluate(:scope => scope))
+ parser.classes["nocode"].code.evaluate(scope))
# Then try merging something into nothing
parser.newclass("nocode2", :code => mkcode.call(%w{foo test}))
@@ -936,7 +936,7 @@ file { "/tmp/yayness":
end
assert(klass, "Did not return class with no code")
assert_equal(%w{foo test},
- parser.classes["nocode2"].code.evaluate(:scope => scope))
+ parser.classes["nocode2"].code.evaluate(scope))
# And lastly, nothing and nothing
klass = parser.newclass("nocode3")
diff --git a/test/language/resource.rb b/test/language/resource.rb
index 5a3916159..3c027ed07 100755
--- a/test/language/resource.rb
+++ b/test/language/resource.rb
@@ -270,8 +270,7 @@ class TestResource < PuppetTest::TestCase
res.scope.expects(:compile).returns(config)
config.expects(:delete_resource).with(res)
- args = {:scope => res.scope, :resource => res}
- type.expects(:evaluate).with(args)
+ type.expects(:evaluate).with(res.scope, res)
res.evaluate
end
diff --git a/test/language/scope.rb b/test/language/scope.rb
index ec11a864e..db9d465bf 100755
--- a/test/language/scope.rb
+++ b/test/language/scope.rb
@@ -284,7 +284,7 @@ class TestScope < Test::Unit::TestCase
)
assert_nothing_raised do
- function.evaluate :scope => scope
+ function.evaluate scope
end
scope.compile.send(:evaluate_generators)
@@ -379,7 +379,7 @@ class TestScope < Test::Unit::TestCase
obj.exported = true
# And then evaluate it
- obj.evaluate :scope => config.topscope
+ obj.evaluate config.topscope
# And run the loop.
config.send(:evaluate_generators)