summaryrefslogtreecommitdiffstats
path: root/test/language
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-06-27 21:14:55 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-06-27 21:14:55 +0000
commitc363af0628386b9d67121db7c4f2fa2a5e8b9f65 (patch)
treedd56c25cb61f8982880ae58fd5cae756728690c8 /test/language
parent57a5a71d517bd8a6ec977f7b17691695299f7959 (diff)
Adding "fail" function, which will raise a ParseError if it is encountered.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1322 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/language')
-rwxr-xr-xtest/language/functions.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/language/functions.rb b/test/language/functions.rb
index e39e23df7..ca941c248 100755
--- a/test/language/functions.rb
+++ b/test/language/functions.rb
@@ -68,6 +68,25 @@ class TestLangFunctions < Test::Unit::TestCase
assert_equal(retval, val, "'tagged' returned %s for %s" % [val, tag])
end
end
+
+ def test_failfunction
+ func = nil
+ assert_nothing_raised do
+ func = Puppet::Parser::AST::Function.new(
+ :name => "fail",
+ :ftype => :statement,
+ :arguments => AST::ASTArray.new(
+ :children => [stringobj("this is a failure")]
+ )
+ )
+ end
+
+ scope = Puppet::Parser::Scope.new()
+ val = nil
+ assert_raise(Puppet::ParseError) do
+ val = func.evaluate(:scope => scope)
+ end
+ end
end
# $Id$