summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/puppet/parser/functions.rb2
-rw-r--r--lib/puppet/parser/scope.rb1
-rwxr-xr-xtest/language/functions.rb30
3 files changed, 32 insertions, 1 deletions
diff --git a/lib/puppet/parser/functions.rb b/lib/puppet/parser/functions.rb
index 288a3bd68..0b94ca76e 100644
--- a/lib/puppet/parser/functions.rb
+++ b/lib/puppet/parser/functions.rb
@@ -110,7 +110,7 @@ module Functions
klasses = evalclasses(*vals)
missing = vals.find_all do |klass|
- ! klass.include?(klass)
+ ! klasses.include?(klass)
end
# Throw an error if we didn't evaluate all of the classes.
diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb
index 6bb8872ee..e81862dad 100644
--- a/lib/puppet/parser/scope.rb
+++ b/lib/puppet/parser/scope.rb
@@ -195,6 +195,7 @@ class Puppet::Parser::Scope
retval << klass
end
end
+ retval
end
def exported?
diff --git a/test/language/functions.rb b/test/language/functions.rb
index 1484a1312..e3ab1ca1e 100755
--- a/test/language/functions.rb
+++ b/test/language/functions.rb
@@ -415,6 +415,36 @@ class TestLangFunctions < Test::Unit::TestCase
assert(ffun, "Could not find definition in 'fun' namespace")
assert(ffoo, "Could not find definition in 'foo' namespace")
end
+
+ def test_include
+ interp = mkinterp
+ scope = mkscope(:interp => interp)
+
+ assert_raise(Puppet::ParseError, "did not throw error on missing class") do
+ scope.function_include("nosuchclass")
+ end
+
+ interp.newclass("myclass")
+
+ assert_nothing_raised do
+ scope.function_include "myclass"
+ end
+
+ assert(scope.classlist.include?("myclass"),
+ "class was not evaluated")
+
+ # Now try multiple classes at once
+ classes = %w{one two three}.each { |c| interp.newclass(c) }
+
+ assert_nothing_raised do
+ scope.function_include classes
+ end
+
+ classes.each do |c|
+ assert(scope.classlist.include?(c),
+ "class %s was not evaluated" % c)
+ end
+ end
end
# $Id$