diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-03-03 18:23:53 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-03-03 18:23:53 +0000 |
| commit | aae9b2aa90c2f1e12baeebe530a0cd8a69fac9c2 (patch) | |
| tree | 22430454ec25742a384e11ac91f829598a8aea42 /test/language/scope.rb | |
| parent | 451ba6d069cb253f901541f420e51c0b184d8d8c (diff) | |
| download | puppet-aae9b2aa90c2f1e12baeebe530a0cd8a69fac9c2.tar.gz puppet-aae9b2aa90c2f1e12baeebe530a0cd8a69fac9c2.tar.xz puppet-aae9b2aa90c2f1e12baeebe530a0cd8a69fac9c2.zip | |
Definitions now always create their own context, which means that they cannot override elements in the containing scopes.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@972 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/language/scope.rb')
| -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 |
