summaryrefslogtreecommitdiffstats
path: root/test/lib
diff options
context:
space:
mode:
authorBrice Figureau <brice-puppet@daysofwonder.com>2009-07-28 19:56:34 +0200
committerJames Turnbull <james@lovedthanlost.net>2009-08-01 11:15:29 +1000
commit3ebf148bf3d82d25e690aec6ec49975e0837e604 (patch)
treeb94504992e575d8b4181440b90bdf510cf67ef8c /test/lib
parentef68967f2b72e609a9d69e53771a61fd9f522149 (diff)
downloadpuppet-3ebf148bf3d82d25e690aec6ec49975e0837e604.tar.gz
puppet-3ebf148bf3d82d25e690aec6ec49975e0837e604.tar.xz
puppet-3ebf148bf3d82d25e690aec6ec49975e0837e604.zip
Enhance selector and case statements to match with regexp
The case and selector statements define ephemeral vars, like 'if'. Usage: case statement: $var = "foobar" case $var { "foo": { notify { "got a foo": } } /(.*)bar$/: { notify{ "hey we got a $1": } } } and for selector: $val = $test ? { /^match.*$/ => "matched", default => "default" } Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'test/lib')
-rw-r--r--test/lib/puppettest/parsertesting.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/lib/puppettest/parsertesting.rb b/test/lib/puppettest/parsertesting.rb
index 8186bf304..dee38eb3a 100644
--- a/test/lib/puppettest/parsertesting.rb
+++ b/test/lib/puppettest/parsertesting.rb
@@ -33,6 +33,11 @@ module PuppetTest::ParserTesting
def safeevaluate(*args)
evaluate()
end
+
+ def evaluate_match(othervalue, scope, options={})
+ value = evaluate()
+ othervalue == value
+ end
end
def astarray(*args)