summaryrefslogtreecommitdiffstats
path: root/test/language/parser.rb
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-08-22 21:27:11 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-08-22 21:27:11 +0000
commit1b2ee4bb9d9fef44bdf8217f45d6893b7609a432 (patch)
treeeeab100adbabf62c809082f8a9ee0b469d017bec /test/language/parser.rb
parentea32a38d73dc4c1dec030c2c52d339e8976b881b (diff)
downloadpuppet-1b2ee4bb9d9fef44bdf8217f45d6893b7609a432.tar.gz
puppet-1b2ee4bb9d9fef44bdf8217f45d6893b7609a432.tar.xz
puppet-1b2ee4bb9d9fef44bdf8217f45d6893b7609a432.zip
Adding "if/else" constructs. No operators, no elsif, but it is a good start, anyway.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1483 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/language/parser.rb')
-rw-r--r--test/language/parser.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/language/parser.rb b/test/language/parser.rb
index 722d95d95..4328096b5 100644
--- a/test/language/parser.rb
+++ b/test/language/parser.rb
@@ -481,6 +481,25 @@ file { "/tmp/yayness":
parser.parse
}
end
+
+ def test_parsingif
+ parser = Puppet::Parser::Parser.new()
+ exec = proc do |val|
+ %{exec { "/bin/echo #{val}": logoutput => true }}
+ end
+ str1 = %{if true { #{exec.call("true")} }}
+ ret = nil
+ assert_nothing_raised {
+ ret = parser.parse(str1)
+ }
+ assert_instance_of(Puppet::Parser::AST::IfStatement, ret)
+ str2 = %{if true { #{exec.call("true")} } else { #{exec.call("false")} }}
+ assert_nothing_raised {
+ ret = parser.parse(str2)
+ }
+ assert_instance_of(Puppet::Parser::AST::IfStatement, ret)
+ assert_instance_of(Puppet::Parser::AST::Else, ret.else)
+ end
end
# $Id$