summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser/parser.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-09-27 21:30:49 +0200
committerLuke Kanies <luke@madstop.com>2008-09-27 21:30:49 +0200
commitb96bdc6a63f7be6b724c2aa7ad0ea007cba81718 (patch)
tree6d334ea12e1468b34160fa36da29dd7d78ac31ea /spec/unit/parser/parser.rb
parente20f02af4a93478c5b08b7681caa12cd72b4a3a6 (diff)
parent3749267093923692d6e7bc0c9ce83b43a487b19e (diff)
downloadpuppet-b96bdc6a63f7be6b724c2aa7ad0ea007cba81718.tar.gz
puppet-b96bdc6a63f7be6b724c2aa7ad0ea007cba81718.tar.xz
puppet-b96bdc6a63f7be6b724c2aa7ad0ea007cba81718.zip
Merge branch '0.24.x' of git://github.com/jamtur01/puppet into 0.24.x
Diffstat (limited to 'spec/unit/parser/parser.rb')
-rwxr-xr-xspec/unit/parser/parser.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/unit/parser/parser.rb b/spec/unit/parser/parser.rb
new file mode 100755
index 000000000..94b19be40
--- /dev/null
+++ b/spec/unit/parser/parser.rb
@@ -0,0 +1,34 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../../spec_helper'
+
+describe Puppet::Parser do
+
+ AST = Puppet::Parser::AST
+
+ before :each do
+ @parser = Puppet::Parser::Parser.new :environment => "development"
+ end
+
+ describe "when parsing append operator" do
+
+ it "should not raise syntax errors" do
+ lambda { @parser.parse("$var += something") }.should_not raise_error
+ end
+
+ it "shouldraise syntax error on incomplete syntax " do
+ lambda { @parser.parse("$var += ") }.should raise_error
+ end
+
+ it "should call AST::VarDef with append=true" do
+ AST::VarDef.expects(:new).with { |h| h[:append] == true }
+ @parser.parse("$var += 2")
+ end
+
+ it "should work with arrays too" do
+ AST::VarDef.expects(:new).with { |h| h[:append] == true }
+ @parser.parse("$var += ['test']")
+ end
+
+ end
+end