diff options
Diffstat (limited to 'test/language')
| -rwxr-xr-x | test/language/scope.rb | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/test/language/scope.rb b/test/language/scope.rb index 2921afb42..a18b75bff 100755 --- a/test/language/scope.rb +++ b/test/language/scope.rb @@ -464,4 +464,53 @@ class TestScope < Test::Unit::TestCase objects = top.evaluate(:scope => scope) } end + + # Verify that definitions have a different context than classes. + def test_newsubcontext + filename = tempfile() + children = [] + + # Create a component + children << compobj("comp", :code => AST::ASTArray.new( + :children => [ + fileobj(filename, "owner" => "root" ) + ] + )) + + # Now create a class that modifies the same file and also + # calls the component + children << classobj("klass", :code => AST::ASTArray.new( + :children => [ + fileobj(filename, "owner" => "bin" ), + AST::ObjectDef.new( + :type => nameobj("comp"), + :params => astarray() + ) + ] + )) + + # Now call the class + children << AST::ObjectDef.new( + :type => nameobj("klass"), + :params => astarray() + ) + + top = nil + assert_nothing_raised("Could not create top object") { + top = AST::ASTArray.new( + :children => children + ) + } + + trans = nil + scope = nil + #assert_nothing_raised { + assert_raise(Puppet::ParseError, "A conflict was allowed") { + scope = Puppet::Parser::Scope.new() + trans = scope.evaluate(:ast => top) + } + # scope = Puppet::Parser::Scope.new() + # trans = scope.evaluate(:ast => top) + #} + end end |
