Apparently the include function was not failing when it could not find asked-for classes. Now it does.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2250 980ebf18-57e1-0310-9a29-db15c13687c0
This commit is contained in:
Родитель
521606bfa8
Коммит
1808c50ea1
|
@ -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.
|
||||
|
|
|
@ -195,6 +195,7 @@ class Puppet::Parser::Scope
|
|||
retval << klass
|
||||
end
|
||||
end
|
||||
retval
|
||||
end
|
||||
|
||||
def exported?
|
||||
|
|
|
@ -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$
|
||||
|
|
Загрузка…
Ссылка в новой задаче