diff options
| author | Luke Kanies <luke@madstop.com> | 2008-02-12 14:57:24 -0600 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2008-02-12 14:57:24 -0600 |
| commit | 7e45553448f2a051594ee4f2fc83ebcfa4a8114a (patch) | |
| tree | 1d64489aa420ee391fb0fe51673fad92232bdcc6 /test/language/scope.rb | |
| parent | 9b66251076e0403afde5b1ad7aa543d18e302a94 (diff) | |
| download | puppet-7e45553448f2a051594ee4f2fc83ebcfa4a8114a.tar.gz puppet-7e45553448f2a051594ee4f2fc83ebcfa4a8114a.tar.xz puppet-7e45553448f2a051594ee4f2fc83ebcfa4a8114a.zip | |
Fixed #997 -- virtual defined types are no longer evaluated.
NOTE: This introduces a behaviour change, in that you previously
could realize a resource within a virtual defined resource, and now
you must realize the entire defined resource, rather than just
the contained resource.
Diffstat (limited to 'test/language/scope.rb')
| -rwxr-xr-x | test/language/scope.rb | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/test/language/scope.rb b/test/language/scope.rb index 9c0e583e4..c96581a23 100755 --- a/test/language/scope.rb +++ b/test/language/scope.rb @@ -328,10 +328,9 @@ class TestScope < Test::Unit::TestCase "undef considered true") end - if defined? ActiveRecord # Verify that we recursively mark as exported the results of collectable # components. - def test_exportedcomponents + def test_virtual_definitions_do_not_get_evaluated config = mkcompiler parser = config.parser @@ -348,7 +347,7 @@ class TestScope < Test::Unit::TestCase :children => [nameobj("arg")] ) - # Create a top-level component + # Create a top-level define parser.newdefine "one", :arguments => [%w{arg}], :code => AST::ASTArray.new( :children => [ @@ -356,27 +355,11 @@ class TestScope < Test::Unit::TestCase ] ) - # And a component that calls it - parser.newdefine "two", :arguments => [%w{arg}], - :code => AST::ASTArray.new( - :children => [ - resourcedef("one", "ptest", {"arg" => varref("arg")}) - ] - ) - - # And then a third component that calls the second - parser.newdefine "three", :arguments => [%w{arg}], - :code => AST::ASTArray.new( - :children => [ - resourcedef("two", "yay", {"arg" => varref("arg")}) - ] - ) - - # lastly, create an object that calls our third component - obj = resourcedef("three", "boo", {"arg" => "parentfoo"}) + # create a resource that calls our third define + obj = resourcedef("one", "boo", {"arg" => "parentfoo"}) - # And mark it as exported - obj.exported = true + # And mark it as virtual + obj.virtual = true # And then evaluate it obj.evaluate config.topscope @@ -385,12 +368,13 @@ class TestScope < Test::Unit::TestCase config.send(:evaluate_generators) %w{File}.each do |type| - objects = config.resources.find_all { |r| r.type == type and r.exported } + objects = config.resources.find_all { |r| r.type == type and r.virtual } - assert(!objects.empty?, "Did not get an exported %s" % type) + assert(objects.empty?, "Virtual define got evaluated") end end + if defined? ActiveRecord # Verify that we can both store and collect an object in the same # run, whether it's in the same scope as a collection or a different # scope. |
