summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-07-10 15:31:19 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-07-10 15:31:19 +0000
commit7a71db875d8833065dbefdaf721f74a65414478c (patch)
tree12afcec70d8e6d88cde02f20186a39b05842c663 /test
parente662c869bf8b2924c12d4ff6f999f0744779257d (diff)
Adding patch by Valentin Vidic to add the "+>" syntax for adding values to parameters
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2670 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
-rwxr-xr-xtest/language/resource.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/language/resource.rb b/test/language/resource.rb
index d2fdd0967..039c67216 100755
--- a/test/language/resource.rb
+++ b/test/language/resource.rb
@@ -69,6 +69,31 @@ class TestResource < PuppetTest::TestCase
end
end
+ def check_paramadd(val1, val2, merged_val)
+ res = mkresource :params => {"one" => val1}
+ assert_nothing_raised do
+ res.set Parser::Resource::Param.new(
+ :name => "one", :value => val2,
+ :add => true, :source => @scope.findclass("sub1"))
+ end
+ assert_equal(merged_val, res[:one])
+ end
+
+ def test_paramadd
+ check_paramadd([], [], [])
+ check_paramadd([], "rah", ["rah"])
+ check_paramadd([], ["rah", "bah"], ["rah", "bah"])
+
+ check_paramadd("yay", [], ["yay"])
+ check_paramadd("yay", "rah", ["yay", "rah"])
+ check_paramadd("yay", ["rah", "bah"], ["yay", "rah", "bah"])
+
+ check_paramadd(["yay", "boo"], [], ["yay", "boo"])
+ check_paramadd(["yay", "boo"], "rah", ["yay", "boo", "rah"])
+ check_paramadd(["yay", "boo"], ["rah", "bah"],
+ ["yay", "boo", "rah", "bah"])
+ end
+
def test_merge
# Start with the normal one
res = mkresource