summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-06-30 00:28:16 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-06-30 00:28:16 +0000
commitf792a02aa153eedf5293791daaf355232f357cc4 (patch)
tree9f8016c956afdcd4391999c87c79641e8306efe0 /test
parent8b60619f5857569c2971237c80cf214cb8e71b3f (diff)
downloadpuppet-f792a02aa153eedf5293791daaf355232f357cc4.tar.gz
puppet-f792a02aa153eedf5293791daaf355232f357cc4.tar.xz
puppet-f792a02aa153eedf5293791daaf355232f357cc4.zip
Moving the template handling into a simple wrapper object so templates don't have full access to the scope object without some real hacking.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1342 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
-rwxr-xr-xtest/language/functions.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/language/functions.rb b/test/language/functions.rb
index ee8f33c59..ae4b115ea 100755
--- a/test/language/functions.rb
+++ b/test/language/functions.rb
@@ -167,6 +167,32 @@ class TestLangFunctions < Test::Unit::TestCase
"Templates were not handled correctly")
end
+
+ def test_tempatefunction_cannot_see_scopes
+ template = tempfile()
+
+ File.open(template, "w") do |f|
+ f.puts "<%= lookupvar('myvar') %>"
+ end
+
+ func = nil
+ assert_nothing_raised do
+ func = Puppet::Parser::AST::Function.new(
+ :name => "template",
+ :ftype => :rvalue,
+ :arguments => AST::ASTArray.new(
+ :children => [stringobj(template)]
+ )
+ )
+ end
+ ast = varobj("output", func)
+
+ scope = Puppet::Parser::Scope.new()
+ scope.setvar("myvar", "this is yayness")
+ assert_raise(Puppet::ParseError) do
+ ast.evaluate(:scope => scope)
+ end
+ end
end
# $Id$