summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorBrice Figureau <brice-puppet@daysofwonder.com>2008-11-15 13:22:26 +0100
committerJames Turnbull <james@lovedthanlost.net>2008-11-17 21:05:50 +1100
commit2c05a0abcb55347c179e66bb0c9d23698e729046 (patch)
tree0de423bda9b6cd03d7417f7a693c6aec800e25e8 /test
parent064fb006a350e9555abe766c5cb4aeb803fd623a (diff)
downloadpuppet-2c05a0abcb55347c179e66bb0c9d23698e729046.tar.gz
puppet-2c05a0abcb55347c179e66bb0c9d23698e729046.tar.xz
puppet-2c05a0abcb55347c179e66bb0c9d23698e729046.zip
Move function existance test to parser evaluation
The aim is to let --parseonly succeeds even if the function is not (yet) present. This is usefull in commit-hooks and for the inline documentation generation system. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'test')
-rwxr-xr-xtest/language/functions.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/test/language/functions.rb b/test/language/functions.rb
index d9a1a561d..7e153ec3d 100755
--- a/test/language/functions.rb
+++ b/test/language/functions.rb
@@ -12,7 +12,7 @@ class TestLangFunctions < Test::Unit::TestCase
include PuppetTest::ParserTesting
include PuppetTest::ResourceTesting
def test_functions
- assert_raise(Puppet::ParseError) do
+ assert_nothing_raised do
Puppet::Parser::AST::Function.new(
:name => "fakefunction",
:arguments => AST::ASTArray.new(
@@ -21,6 +21,16 @@ class TestLangFunctions < Test::Unit::TestCase
)
end
+ assert_raise(Puppet::ParseError) do
+ func = Puppet::Parser::AST::Function.new(
+ :name => "fakefunction",
+ :arguments => AST::ASTArray.new(
+ :children => [nameobj("avalue")]
+ )
+ )
+ func.evaluate(mkscope)
+ end
+
assert_nothing_raised do
Puppet::Parser::Functions.newfunction(:fakefunction, :type => :rvalue) do |input|
return "output %s" % input[0]