From f792a02aa153eedf5293791daaf355232f357cc4 Mon Sep 17 00:00:00 2001 From: luke Date: Fri, 30 Jun 2006 00:28:16 +0000 Subject: 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 --- test/language/functions.rb | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'test') 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$ -- cgit