summaryrefslogtreecommitdiffstats
path: root/test/language
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-05-13 02:14:35 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-05-13 02:14:35 +0000
commit0819e35be74bc997c3a953f05bab874b8d76429d (patch)
treea7abcf53ed750c8b530d7de88374a354f4b6bf2a /test/language
parent678e14286f441524955c76fcfca6abace7106774 (diff)
Adding some small changes towards fixing #140 and #83, but this work needs to take a back seat to object collection, so i will come back to it later.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1186 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/language')
-rwxr-xr-xtest/language/ast.rb53
1 files changed, 53 insertions, 0 deletions
diff --git a/test/language/ast.rb b/test/language/ast.rb
index 781e9ddd0..b714fcdea 100755
--- a/test/language/ast.rb
+++ b/test/language/ast.rb
@@ -752,6 +752,59 @@ class TestAST < Test::Unit::TestCase
"Could not find file %s" % file)
end
end
+
+ # To fix #140. Currently non-functional.
+ def disabled_test_classreuse
+ children = []
+
+ # Create the parent class, with a definition in it.
+ children << classobj("parent", :code => AST::ASTArray.new(
+ :file => __FILE__,
+ :line => __LINE__,
+ :children => [
+ compobj("foo", :args => AST::ASTArray.new(
+ :children => [nameobj("arg")]
+ ),
+ :code => AST::ASTArray.new(
+ :file => __FILE__,
+ :line => __LINE__,
+ :children => [fileobj("/$arg")]
+ )
+ ),
+ objectdef("foo", "ptest", {"arg" => "parentfoo"})
+ ]
+ ))
+
+ # Create child class, also trying to use that definition
+ children << classobj("child1", :parentclass => nameobj("parent"),
+ :code => AST::ASTArray.new(
+ :file => __FILE__,
+ :line => __LINE__,
+ :children => [
+ objectdef("foo", "ctest", {"arg" => "childfoo"})
+ ]
+ )
+ )
+
+ # Call the parent first
+ children << functionobj("include", "parent")
+
+ # Then call the child, and make sure it can look up the definition
+ children << functionobj("include", "child1")
+
+ top = nil
+ assert_nothing_raised("Could not create top object") {
+ top = AST::ASTArray.new(
+ :children => children
+ )
+ }
+
+ objects = nil
+ assert_nothing_raised("Could not evaluate") {
+ scope = Puppet::Parser::Scope.new()
+ objects = scope.evaluate(:ast => top)
+ }
+ end
end
# $Id$