diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-08-22 00:33:44 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-08-22 00:33:44 +0000 |
| commit | ea32a38d73dc4c1dec030c2c52d339e8976b881b (patch) | |
| tree | 616b935ad7b17fcee8d8dd345618f3446f5f1b59 /test | |
| parent | bba972fd1bcbb7747f73eee6b6789e02ad18071a (diff) | |
| download | puppet-ea32a38d73dc4c1dec030c2c52d339e8976b881b.tar.gz puppet-ea32a38d73dc4c1dec030c2c52d339e8976b881b.tar.xz puppet-ea32a38d73dc4c1dec030c2c52d339e8976b881b.zip | |
Function autoloading now works as requested in #214.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1482 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
| -rwxr-xr-x | test/language/functions.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/language/functions.rb b/test/language/functions.rb index d931470fc..97ddbca00 100755 --- a/test/language/functions.rb +++ b/test/language/functions.rb @@ -240,6 +240,33 @@ class TestLangFunctions < Test::Unit::TestCase assert(parsedate != newdate, "Parse date did not change") end + + def test_autoloading_functions + assert_equal(false, Puppet::Parser::Functions.function(:autofunc), + "Got told autofunc already exists") + + dir = tempfile() + $: << dir + newpath = File.join(dir, "puppet", "parser", "functions") + FileUtils.mkdir_p(newpath) + + File.open(File.join(newpath, "autofunc.rb"), "w") { |f| + f.puts %{ + Puppet::Parser::Functions.newfunction(:autofunc, :rvalue) do |vals| + Puppet.wanring vals.inspect + end + } + } + + obj = nil + assert_nothing_raised { + obj = Puppet::Parser::Functions.function(:autofunc) + } + + assert(obj, "Did not autoload function") + assert(Puppet::Parser::Scope.method_defined?(:function_autofunc), + "Did not set function correctly") + end end # $Id$ |
