summaryrefslogtreecommitdiffstats
path: root/test/language/ast
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-09-06 20:00:24 -0500
committerLuke Kanies <luke@madstop.com>2007-09-06 20:00:24 -0500
commit4212f9c2250377793d6ed636c18c7a8538160366 (patch)
treef43b0754ada52c7e1ab41f6be0a7f820b6b05c90 /test/language/ast
parent4104bd3ee9fa146b49aa446fbf4cc3edcdf0974d (diff)
downloadpuppet-4212f9c2250377793d6ed636c18c7a8538160366.tar.gz
puppet-4212f9c2250377793d6ed636c18c7a8538160366.tar.xz
puppet-4212f9c2250377793d6ed636c18c7a8538160366.zip
Fixing #802 -- tags are now applied before parent classes are evaluated, so parent classes can use tagged() to test if a node is a member of a subclass.
Diffstat (limited to 'test/language/ast')
-rwxr-xr-xtest/language/ast/hostclass.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/language/ast/hostclass.rb b/test/language/ast/hostclass.rb
index b53f6d5c0..f747779b3 100755
--- a/test/language/ast/hostclass.rb
+++ b/test/language/ast/hostclass.rb
@@ -164,4 +164,21 @@ class TestASTHostClass < Test::Unit::TestCase
assert(result, "could not find parent-defined definition from sub")
assert(fun == result, "found incorrect parent-defined definition from sub")
end
+
+ # #795 - make sure the subclass's tags get set before we
+ # evaluate the parent class, so we can be sure that the parent
+ # class can switch based on the sub classes.
+ def test_tags_set_before_parent_is_evaluated
+ scope = mkscope
+ parser = scope.compile.parser
+ base = parser.newclass "base"
+ sub = parser.newclass "sub", :parent => "base"
+
+ base.expects(:safeevaluate).with do |args|
+ assert(scope.compile.configuration.tags.include?("sub"), "Did not tag with sub class name before evaluating base class")
+ base.evaluate(args)
+ true
+ end
+ sub.evaluate :scope => scope, :resource => scope.resource
+ end
end