summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-01-26 22:15:49 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-01-26 22:15:49 +0000
commit37acfb9bc8675f33aef159f298e35e3e43998c4f (patch)
tree1d46a52011169b71fa09fa358fd63aecb9ba0008 /test
parent2db68781a11de7b135d0abc332ed144c4e4b71c3 (diff)
Fixing #442. You can now do: defined(File[...]) to see if a resource is defined.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2097 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
-rwxr-xr-xtest/language/functions.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/language/functions.rb b/test/language/functions.rb
index 57afa6d41..edb7a3004 100755
--- a/test/language/functions.rb
+++ b/test/language/functions.rb
@@ -382,6 +382,17 @@ class TestLangFunctions < Test::Unit::TestCase
# and make sure multiple falses are still false
assert(! scope.function_defined(%w{no otherno stillno}),
"Multiple falses were somehow true")
+
+ # Now make sure we can test resources
+ scope.setresource mkresource(:type => "file", :title => "/tmp/rahness",
+ :scope => scope, :source => scope.source,
+ :params => {:owner => "root"})
+
+ yep = Puppet::Parser::Resource::Reference.new(:type => "file", :title => "/tmp/rahness")
+ nope = Puppet::Parser::Resource::Reference.new(:type => "file", :title => "/tmp/fooness")
+
+ assert(scope.function_defined([yep]), "valid resource was not considered defined")
+ assert(! scope.function_defined([nope]), "invalid resource was considered defined")
end
end