summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser
diff options
context:
space:
mode:
authorIan Taylor <ian@lorf.org>2009-06-05 12:39:04 -0400
committerJames Turnbull <james@lovedthanlost.net>2009-06-06 09:12:00 +1000
commit4f2c066a97e59a89df64af4b25beac6f3f0553c2 (patch)
tree126540beec3c65448e01e1b48d27275ec4ee6ea4 /spec/unit/parser
parent97e6975d69f239e24993315a25a3117b1daa48c3 (diff)
downloadpuppet-4f2c066a97e59a89df64af4b25beac6f3f0553c2.tar.gz
puppet-4f2c066a97e59a89df64af4b25beac6f3f0553c2.tar.xz
puppet-4f2c066a97e59a89df64af4b25beac6f3f0553c2.zip
Removed extra whitespace from end of lines
Diffstat (limited to 'spec/unit/parser')
-rw-r--r--spec/unit/parser/ast.rb2
-rwxr-xr-xspec/unit/parser/ast/arithmetic_operator.rb4
-rwxr-xr-xspec/unit/parser/ast/astarray.rb20
-rwxr-xr-xspec/unit/parser/ast/boolean_operator.rb2
-rwxr-xr-xspec/unit/parser/ast/collexpr.rb12
-rwxr-xr-xspec/unit/parser/ast/comparison_operator.rb18
-rwxr-xr-xspec/unit/parser/ast/minus.rb2
-rwxr-xr-xspec/unit/parser/ast/not.rb2
-rwxr-xr-xspec/unit/parser/ast/resource_override.rb10
-rwxr-xr-xspec/unit/parser/ast/resource_reference.rb10
-rwxr-xr-xspec/unit/parser/ast/vardef.rb18
-rwxr-xr-xspec/unit/parser/collector.rb2
-rwxr-xr-xspec/unit/parser/compiler.rb12
-rw-r--r--spec/unit/parser/files.rb2
-rwxr-xr-xspec/unit/parser/functions/versioncmp.rb4
-rwxr-xr-xspec/unit/parser/interpreter.rb2
-rwxr-xr-xspec/unit/parser/lexer.rb6
-rwxr-xr-xspec/unit/parser/parser.rb26
18 files changed, 77 insertions, 77 deletions
diff --git a/spec/unit/parser/ast.rb b/spec/unit/parser/ast.rb
index 35e2b1eff..35f575b1b 100644
--- a/spec/unit/parser/ast.rb
+++ b/spec/unit/parser/ast.rb
@@ -5,7 +5,7 @@ require File.dirname(__FILE__) + '/../../spec_helper'
require 'puppet/parser/ast'
describe Puppet::Parser::AST do
-
+
it "should use the file lookup module" do
Puppet::Parser::AST.ancestors.should be_include(Puppet::FileCollection::Lookup)
end
diff --git a/spec/unit/parser/ast/arithmetic_operator.rb b/spec/unit/parser/ast/arithmetic_operator.rb
index 9c1ff864e..4a0be483b 100755
--- a/spec/unit/parser/ast/arithmetic_operator.rb
+++ b/spec/unit/parser/ast/arithmetic_operator.rb
@@ -17,7 +17,7 @@ describe Puppet::Parser::AST::ArithmeticOperator do
lval.expects(:safeevaluate).with(@scope).returns(1)
rval = stub "rval"
rval.expects(:safeevaluate).with(@scope).returns(2)
-
+
operator = ast::ArithmeticOperator.new :rval => rval, :operator => "+", :lval => lval
operator.evaluate(@scope)
end
@@ -65,7 +65,7 @@ describe Puppet::Parser::AST::ArithmeticOperator do
@scope.expects(:lookupvar).with("two").returns(2)
one = ast::Variable.new( :value => "one" )
two = ast::Variable.new( :value => "two" )
-
+
operator = ast::ArithmeticOperator.new :lval => one, :operator => "+", :rval => two
operator.evaluate(@scope).should == 3
end
diff --git a/spec/unit/parser/ast/astarray.rb b/spec/unit/parser/ast/astarray.rb
index b3026fe1e..212c3fd14 100755
--- a/spec/unit/parser/ast/astarray.rb
+++ b/spec/unit/parser/ast/astarray.rb
@@ -11,14 +11,14 @@ describe Puppet::Parser::AST::ASTArray do
array = Puppet::Parser::AST::ASTArray.new :children => []
array.should respond_to(:[])
end
-
+
it "should evaluate all its children" do
item1 = stub "item1", :is_a? => true
item2 = stub "item2", :is_a? => true
item1.expects(:safeevaluate).with(@scope).returns(123)
item2.expects(:safeevaluate).with(@scope).returns(246)
-
+
operator = Puppet::Parser::AST::ASTArray.new :children => [item1,item2]
operator.evaluate(@scope)
end
@@ -29,9 +29,9 @@ describe Puppet::Parser::AST::ASTArray do
item2.stubs(:is_a?).with(Puppet::Parser::AST).returns(true)
item2.stubs(:instance_of?).with(Puppet::Parser::AST::ASTArray).returns(true)
item2.stubs(:each).yields(item1)
-
+
item1.expects(:safeevaluate).with(@scope).returns(123)
-
+
operator = Puppet::Parser::AST::ASTArray.new :children => [item2]
operator.evaluate(@scope).should == [123]
end
@@ -42,9 +42,9 @@ describe Puppet::Parser::AST::ASTArray do
item2.stubs(:is_a?).with(Puppet::Parser::AST).returns(true)
item2.stubs(:instance_of?).with(Puppet::Parser::AST::ASTArray).returns(true)
item2.stubs(:each).yields([item1])
-
+
item1.expects(:safeevaluate).with(@scope).returns(123)
-
+
operator = Puppet::Parser::AST::ASTArray.new :children => [item2]
operator.evaluate(@scope).should == [123]
end
@@ -55,12 +55,12 @@ describe Puppet::Parser::AST::ASTArray do
item2.stubs(:is_a?).with(Puppet::Parser::AST).returns(true)
item2.stubs(:instance_of?).with(Puppet::Parser::AST::ASTArray).returns(true)
item2.stubs(:each).yields([item1])
-
+
item1.expects(:safeevaluate).with(@scope).returns([123])
-
+
operator = Puppet::Parser::AST::ASTArray.new :children => [item2]
operator.evaluate(@scope).should == [[123]]
end
-
-
+
+
end
diff --git a/spec/unit/parser/ast/boolean_operator.rb b/spec/unit/parser/ast/boolean_operator.rb
index 13f5e6530..d8e9603e8 100755
--- a/spec/unit/parser/ast/boolean_operator.rb
+++ b/spec/unit/parser/ast/boolean_operator.rb
@@ -17,7 +17,7 @@ describe Puppet::Parser::AST::BooleanOperator do
lval.expects(:safeevaluate).with(@scope).returns("true")
rval = stub "rval", :safeevaluate => false
rval.expects(:safeevaluate).never
-
+
operator = ast::BooleanOperator.new :rval => rval, :operator => "or", :lval => lval
operator.evaluate(@scope)
end
diff --git a/spec/unit/parser/ast/collexpr.rb b/spec/unit/parser/ast/collexpr.rb
index 5f0ca941e..51cd820a2 100755
--- a/spec/unit/parser/ast/collexpr.rb
+++ b/spec/unit/parser/ast/collexpr.rb
@@ -7,9 +7,9 @@ describe Puppet::Parser::AST::CollExpr do
ast = Puppet::Parser::AST
before :each do
- @scope = Puppet::Parser::Scope.new()
+ @scope = Puppet::Parser::Scope.new()
end
-
+
describe "when evaluating with two operands" do
before :each do
@test1 = mock 'test1'
@@ -31,14 +31,14 @@ describe Puppet::Parser::AST::CollExpr do
end
it "should propagate expression type and form to child if expression themselves" do
- [@test1, @test2].each do |t|
+ [@test1, @test2].each do |t|
t.expects(:is_a?).returns(true)
t.expects(:form).returns(false)
t.expects(:type).returns(false)
t.expects(:type=)
t.expects(:form=)
end
-
+
collexpr = ast::CollExpr.new(:test1 => @test1, :test2 => @test2, :oper=>"==", :form => true, :type => true)
result = collexpr.evaluate(@scope)
end
@@ -48,7 +48,7 @@ describe Puppet::Parser::AST::CollExpr do
@resource = mock 'resource'
@resource.expects(:[]).with("test1").at_least(1).returns("test2")
end
-
+
it "should evaluate like the original expression for ==" do
collexpr = ast::CollExpr.new(:test1 => @test1, :test2 => @test2, :oper => "==")
collexpr.evaluate(@scope)[1].call(@resource).should === (@resource["test1"] == "test2")
@@ -73,7 +73,7 @@ describe Puppet::Parser::AST::CollExpr do
end
end
end
-
+
it "should check for array member equality if resource parameter is an array for ==" do
array = mock 'array', :safeevaluate => "array"
test1 = mock 'test1'
diff --git a/spec/unit/parser/ast/comparison_operator.rb b/spec/unit/parser/ast/comparison_operator.rb
index 80e8307fa..26311797f 100755
--- a/spec/unit/parser/ast/comparison_operator.rb
+++ b/spec/unit/parser/ast/comparison_operator.rb
@@ -14,7 +14,7 @@ describe Puppet::Parser::AST::ComparisonOperator do
lval.expects(:safeevaluate).with(@scope)
rval = stub "rval"
rval.expects(:safeevaluate).with(@scope)
-
+
operator = Puppet::Parser::AST::ComparisonOperator.new :lval => lval, :operator => "==", :rval => rval
operator.evaluate(@scope)
end
@@ -22,18 +22,18 @@ describe Puppet::Parser::AST::ComparisonOperator do
it "should convert arguments strings to numbers if they are" do
Puppet::Parser::Scope.expects(:number?).with("1").returns(1)
Puppet::Parser::Scope.expects(:number?).with("2").returns(2)
-
+
operator = Puppet::Parser::AST::ComparisonOperator.new :lval => @one, :operator => "==", :rval => @two
operator.evaluate(@scope)
end
-
+
%w{< > <= >= ==}.each do |oper|
it "should use string comparison #{oper} if operands are strings" do
lval = stub 'one', :safeevaluate => "one"
rval = stub 'two', :safeevaluate => "two"
Puppet::Parser::Scope.stubs(:number?).with("one").returns(nil)
Puppet::Parser::Scope.stubs(:number?).with("two").returns(nil)
-
+
operator = Puppet::Parser::AST::ComparisonOperator.new :lval => lval, :operator => oper, :rval => rval
operator.evaluate(@scope).should == "one".send(oper,"two")
end
@@ -44,11 +44,11 @@ describe Puppet::Parser::AST::ComparisonOperator do
rval = stub 'two', :safeevaluate => "2"
Puppet::Parser::Scope.stubs(:number?).with("one").returns(nil)
Puppet::Parser::Scope.stubs(:number?).with("2").returns(2)
-
+
operator = Puppet::Parser::AST::ComparisonOperator.new :lval => lval, :operator => ">", :rval => rval
lambda { operator.evaluate(@scope) }.should raise_error(ArgumentError)
end
-
+
it "should fail for an unknown operator" do
lambda { operator = Puppet::Parser::AST::ComparisonOperator.new :lval => @one, :operator => "or", :rval => @two }.should raise_error
end
@@ -56,7 +56,7 @@ describe Puppet::Parser::AST::ComparisonOperator do
%w{< > <= >= ==}.each do |oper|
it "should return the result of using '#{oper}' to compare the left and right sides" do
operator = Puppet::Parser::AST::ComparisonOperator.new :lval => @one, :operator => oper, :rval => @two
-
+
operator.evaluate(@scope).should == 1.send(oper,2)
end
end
@@ -73,7 +73,7 @@ describe Puppet::Parser::AST::ComparisonOperator do
@scope.expects(:lookupvar).with("one").returns(1)
@scope.expects(:lookupvar).with("two").returns(2)
-
+
operator = Puppet::Parser::AST::ComparisonOperator.new :lval => one, :operator => "<", :rval => two
operator.evaluate(@scope).should == true
end
@@ -84,7 +84,7 @@ describe Puppet::Parser::AST::ComparisonOperator do
ten = stub 'one', :safeevaluate => "10"
nine = stub 'two', :safeevaluate => "9"
operator = Puppet::Parser::AST::ComparisonOperator.new :lval => ten, :operator => oper, :rval => nine
-
+
operator.evaluate(@scope).should == 10.send(oper,9)
end
end
diff --git a/spec/unit/parser/ast/minus.rb b/spec/unit/parser/ast/minus.rb
index 83bd92d0d..782fd3e0c 100755
--- a/spec/unit/parser/ast/minus.rb
+++ b/spec/unit/parser/ast/minus.rb
@@ -10,7 +10,7 @@ describe Puppet::Parser::AST::Minus do
it "should evaluate its argument" do
value = stub "value"
value.expects(:safeevaluate).with(@scope).returns(123)
-
+
operator = Puppet::Parser::AST::Minus.new :value => value
operator.evaluate(@scope)
end
diff --git a/spec/unit/parser/ast/not.rb b/spec/unit/parser/ast/not.rb
index 0fe2deddd..a3bf0b85d 100755
--- a/spec/unit/parser/ast/not.rb
+++ b/spec/unit/parser/ast/not.rb
@@ -12,7 +12,7 @@ describe Puppet::Parser::AST::Not do
it "should evaluate its child expression" do
val = stub "val"
val.expects(:safeevaluate).with(@scope)
-
+
operator = Puppet::Parser::AST::Not.new :value => val
operator.evaluate(@scope)
end
diff --git a/spec/unit/parser/ast/resource_override.rb b/spec/unit/parser/ast/resource_override.rb
index c1520bf78..2735757d4 100755
--- a/spec/unit/parser/ast/resource_override.rb
+++ b/spec/unit/parser/ast/resource_override.rb
@@ -31,19 +31,19 @@ describe Puppet::Parser::AST::ResourceOverride do
it "should return the overriden resource directly when called with one item" do
klass = stub 'klass', :title => "title", :type => "one"
object = mock 'object', :safeevaluate => klass
- override = ast::ResourceOverride.new(:object => object , :params => @params).evaluate(@scope)
+ override = ast::ResourceOverride.new(:object => object , :params => @params).evaluate(@scope)
override.should be_an_instance_of(Puppet::Parser::Resource)
override.title.should == "title"
- override.type.should == "One"
+ override.type.should == "One"
end
it "should return an array of overriden resources when called with an array of titles" do
klass1 = stub 'klass1', :title => "title1", :type => "one"
klass2 = stub 'klass2', :title => "title2", :type => "one"
-
+
object = mock 'object', :safeevaluate => [klass1,klass2]
-
- override = ast::ResourceOverride.new(:object => object , :params => @params).evaluate(@scope)
+
+ override = ast::ResourceOverride.new(:object => object , :params => @params).evaluate(@scope)
override.should have(2).elements
override.each {|o| o.should be_an_instance_of(Puppet::Parser::Resource) }
end
diff --git a/spec/unit/parser/ast/resource_reference.rb b/spec/unit/parser/ast/resource_reference.rb
index ce2915a97..c7b6e8780 100755
--- a/spec/unit/parser/ast/resource_reference.rb
+++ b/spec/unit/parser/ast/resource_reference.rb
@@ -23,7 +23,7 @@ describe Puppet::Parser::AST::ResourceReference do
it "should evaluate correctly reference to define" do
klass = stub 'klass', :title => "three", :classname => type
@scope.stubs(:finddefine).returns(klass)
-
+
newref("three", type).evaluate(@scope).to_ref.should == Puppet::Parser::Resource::Reference.new( :type => type, :title => "three" ).to_ref
end
end
@@ -31,13 +31,13 @@ describe Puppet::Parser::AST::ResourceReference do
it "should be able to call qualified_class" do
klass = stub 'klass', :title => "three", :classname => "one"
@scope.expects(:findclass).with("one").returns(klass)
- newref("three","class").qualified_class(@scope,"one").should == "one"
+ newref("three","class").qualified_class(@scope,"one").should == "one"
end
it "should be able to find qualified classes when evaluating" do
klass = stub 'klass', :title => "one", :classname => "one"
@scope.stubs(:findclass).returns(klass)
-
+
evaled = newref("one", "class").evaluate(@scope)
evaled.type.should == "Class"
evaled.title.should == "one"
@@ -47,7 +47,7 @@ describe Puppet::Parser::AST::ResourceReference do
titles = mock 'titles', :safeevaluate => ["title1","title2"]
ref = ast::ResourceReference.new( :title => titles, :type => "Resource" )
ref.stubs(:qualified_type).with(@scope).returns("Resource")
-
+
ref.evaluate(@scope).should have(2).elements
end
@@ -56,7 +56,7 @@ describe Puppet::Parser::AST::ResourceReference do
ref = ast::ResourceReference.new( :title => titles, :type => "Class" )
ref.expects(:qualified_class).with(@scope,"title1").returns("class")
ref.expects(:qualified_class).with(@scope,"title2").returns("class")
-
+
ref.evaluate(@scope)
end
diff --git a/spec/unit/parser/ast/vardef.rb b/spec/unit/parser/ast/vardef.rb
index 6bd355c89..14de68923 100755
--- a/spec/unit/parser/ast/vardef.rb
+++ b/spec/unit/parser/ast/vardef.rb
@@ -12,11 +12,11 @@ describe Puppet::Parser::AST::VarDef do
it "should evaluate arguments" do
name = mock 'name'
value = mock 'value'
-
+
name.expects(:safeevaluate).with(@scope)
value.expects(:safeevaluate).with(@scope)
- vardef = Puppet::Parser::AST::VarDef.new :name => name, :value => value, :file => nil,
+ vardef = Puppet::Parser::AST::VarDef.new :name => name, :value => value, :file => nil,
:line => nil
vardef.evaluate(@scope)
end
@@ -24,21 +24,21 @@ describe Puppet::Parser::AST::VarDef do
it "should be in append=false mode if called without append" do
name = stub 'name', :safeevaluate => "var"
value = stub 'value', :safeevaluate => "1"
-
+
@scope.expects(:setvar).with { |name,value,file,line,append| append == nil }
-
- vardef = Puppet::Parser::AST::VarDef.new :name => name, :value => value, :file => nil,
+
+ vardef = Puppet::Parser::AST::VarDef.new :name => name, :value => value, :file => nil,
:line => nil
vardef.evaluate(@scope)
end
-
+
it "should call scope in append mode if append is true" do
name = stub 'name', :safeevaluate => "var"
value = stub 'value', :safeevaluate => "1"
-
+
@scope.expects(:setvar).with { |name,value,file,line,append| append == true }
-
- vardef = Puppet::Parser::AST::VarDef.new :name => name, :value => value, :file => nil,
+
+ vardef = Puppet::Parser::AST::VarDef.new :name => name, :value => value, :file => nil,
:line => nil, :append => true
vardef.evaluate(@scope)
end
diff --git a/spec/unit/parser/collector.rb b/spec/unit/parser/collector.rb
index 4756204ce..813fbb8c0 100755
--- a/spec/unit/parser/collector.rb
+++ b/spec/unit/parser/collector.rb
@@ -496,7 +496,7 @@ describe Puppet::Parser::Collector, "when building its ActiveRecord query for co
Puppet::Rails::Resource.stubs(:find).with { |*arguments|
options = arguments[3]
- options[:conditions][0] =~ /^host_id != \?/ and options[:conditions][1] == 5
+ options[:conditions][0] =~ /^host_id != \?/ and options[:conditions][1] == 5
}.returns([])
@collector.evaluate
diff --git a/spec/unit/parser/compiler.rb b/spec/unit/parser/compiler.rb
index cf5ad086a..1a037b090 100755
--- a/spec/unit/parser/compiler.rb
+++ b/spec/unit/parser/compiler.rb
@@ -187,7 +187,7 @@ describe Puppet::Parser::Compiler do
@compiler.add_resource(@scope, resource)
resource.expects(:evaluate).never
-
+
@compiler.compile
end
@@ -198,7 +198,7 @@ describe Puppet::Parser::Compiler do
# We have to now mark the resource as evaluated
resource.expects(:evaluate).with { |*whatever| resource.evaluated = true }
-
+
@compiler.compile
end
@@ -206,7 +206,7 @@ describe Puppet::Parser::Compiler do
resource = stub 'already_evaluated', :ref => "File[testing]", :builtin? => false, :evaluated? => true, :virtual? => false
@compiler.add_resource(@scope, resource)
resource.expects(:evaluate).never
-
+
@compiler.compile
end
@@ -220,7 +220,7 @@ describe Puppet::Parser::Compiler do
resource.expects(:evaluate).with { |*whatever| resource.evaluated = true; @compiler.add_resource(@scope, resource2) }
resource2.expects(:evaluate).with { |*whatever| resource2.evaluated = true }
-
+
@compiler.compile
end
@@ -296,7 +296,7 @@ describe Puppet::Parser::Compiler do
@compiler.add_resource(@scope, resource)
resource.expects(:evaluate).never
-
+
@compiler.compile
end
end
@@ -307,7 +307,7 @@ describe Puppet::Parser::Compiler do
2.times { |i|
coll = mock 'coll%s' % i
@compiler.add_collection(coll)
-
+
# This is the hard part -- we have to emulate the fact that
# collections delete themselves if they are done evaluating.
coll.expects(:evaluate).with do
diff --git a/spec/unit/parser/files.rb b/spec/unit/parser/files.rb
index 2c91ea7e4..7aa1a34f5 100644
--- a/spec/unit/parser/files.rb
+++ b/spec/unit/parser/files.rb
@@ -26,7 +26,7 @@ describe Puppet::Parser::Files do
mod.expects(:template).returns("/one/mymod/templates/mytemplate")
Puppet::Parser::Files.find_template("mymod/mytemplate").should == "/one/mymod/templates/mytemplate"
end
-
+
it "should return the file in the templatedir if it exists" do
Puppet.settings.expects(:value).with(:templatedir, nil).returns("/my/templates")
Puppet[:modulepath] = "/one:/two"
diff --git a/spec/unit/parser/functions/versioncmp.rb b/spec/unit/parser/functions/versioncmp.rb
index 06b125ea0..0595f8711 100755
--- a/spec/unit/parser/functions/versioncmp.rb
+++ b/spec/unit/parser/functions/versioncmp.rb
@@ -15,11 +15,11 @@ describe "the versioncmp function" do
it "should raise a ParseError if there is less than 2 arguments" do
lambda { @scope.function_versioncmp(["1.2"]) }.should raise_error(Puppet::ParseError)
end
-
+
it "should raise a ParseError if there is more than 2 arguments" do
lambda { @scope.function_versioncmp(["1.2", "2.4.5", "3.5.6"]) }.should raise_error(Puppet::ParseError)
end
-
+
it "should call Puppet::Util::Package.versioncmp (included in scope)" do
Puppet::Util::Package.expects(:versioncmp).with("1.2", "1.3").returns(-1)
diff --git a/spec/unit/parser/interpreter.rb b/spec/unit/parser/interpreter.rb
index fe63bbd65..f06186a4e 100755
--- a/spec/unit/parser/interpreter.rb
+++ b/spec/unit/parser/interpreter.rb
@@ -98,7 +98,7 @@ describe Puppet::Parser::Interpreter do
@interp.expects(:create_parser).with(:myenv).raises(Puppet::Error, "Could not parse")
- lambda { @interp.parser(:myenv) }.should raise_error(Puppet::Error)
+ lambda { @interp.parser(:myenv) }.should raise_error(Puppet::Error)
end
end
end
diff --git a/spec/unit/parser/lexer.rb b/spec/unit/parser/lexer.rb
index 24c34632f..2946c4152 100755
--- a/spec/unit/parser/lexer.rb
+++ b/spec/unit/parser/lexer.rb
@@ -135,10 +135,10 @@ describe Puppet::Parser::Lexer::TOKENS do
:LBRACE => '{',
:RBRACE => '}',
:LPAREN => '(',
- :RPAREN => ')',
+ :RPAREN => ')',
:EQUALS => '=',
:ISEQUAL => '==',
- :GREATEREQUAL => '>=',
+ :GREATEREQUAL => '>=',
:GREATERTHAN => '>',
:LESSTHAN => '<',
:LESSEQUAL => '<=',
@@ -551,7 +551,7 @@ describe "Puppet::Parser::Lexer in the old tests" do
it "should correctly parse names with numerals" do
string = %w{1name name1 11names names11}
-
+
string.each { |t|
@lexer.string = t
@lexer.fullscan.should == [[:NAME,t],[false,false]]
diff --git a/spec/unit/parser/parser.rb b/spec/unit/parser/parser.rb
index ef05bc876..2c34bb64b 100755
--- a/spec/unit/parser/parser.rb
+++ b/spec/unit/parser/parser.rb
@@ -40,7 +40,7 @@ describe Puppet::Parser do
end
it "boolean operation, it should create the correct ast objects" do
- ast::BooleanOperator.expects(:new).with {
+ ast::BooleanOperator.expects(:new).with {
|h| h[:rval].is_a?(ast::Boolean) and h[:lval].is_a?(ast::Boolean) and h[:operator]=="or"
}
@parser.parse("if true or true { $var = 1 }")
@@ -48,7 +48,7 @@ describe Puppet::Parser do
end
it "comparison operation, it should create the correct ast objects" do
- ast::ComparisonOperator.expects(:new).with {
+ ast::ComparisonOperator.expects(:new).with {
|h| h[:lval].is_a?(ast::Name) and h[:rval].is_a?(ast::Name) and h[:operator]=="<"
}
@parser.parse("if 1 < 2 { $var = 1 }")
@@ -60,10 +60,10 @@ describe Puppet::Parser do
describe Puppet::Parser, "when parsing if complex expressions" do
it "should create a correct ast tree" do
aststub = stub_everything 'ast'
- ast::ComparisonOperator.expects(:new).with {
+ ast::ComparisonOperator.expects(:new).with {
|h| h[:rval].is_a?(ast::Name) and h[:lval].is_a?(ast::Name) and h[:operator]==">"
}.returns(aststub)
- ast::ComparisonOperator.expects(:new).with {
+ ast::ComparisonOperator.expects(:new).with {
|h| h[:rval].is_a?(ast::Name) and h[:lval].is_a?(ast::Name) and h[:operator]=="=="
}.returns(aststub)
ast::BooleanOperator.expects(:new).with {
@@ -79,7 +79,7 @@ describe Puppet::Parser do
end
describe Puppet::Parser, "when parsing resource references" do
-
+
it "should not raise syntax errors" do
lambda { @parser.parse('exec { test: param => File["a"] }') }.should_not raise_error
end
@@ -87,18 +87,18 @@ describe Puppet::Parser do
it "should not raise syntax errors with multiple references" do
lambda { @parser.parse('exec { test: param => File["a","b"] }') }.should_not raise_error
end
-
+
it "should create an ast::ResourceReference" do
ast::Resource.stubs(:new)
- ast::ResourceReference.expects(:new).with { |arg|
+ ast::ResourceReference.expects(:new).with { |arg|
arg[:line]==1 and arg[:type]=="File" and arg[:title].is_a?(ast::ASTArray)
}
@parser.parse('exec { test: command => File["a","b"] }')
end
end
-
+
describe Puppet::Parser, "when parsing resource overrides" do
-
+
it "should not raise syntax errors" do
lambda { @parser.parse('Resource["title"] { param => value }') }.should_not raise_error
end
@@ -108,14 +108,14 @@ describe Puppet::Parser do
end
it "should create an ast::ResourceOverride" do
- ast::ResourceOverride.expects(:new).with { |arg|
+ ast::ResourceOverride.expects(:new).with { |arg|
arg[:line]==1 and arg[:object].is_a?(ast::ResourceReference) and arg[:params].is_a?(ast::ResourceParam)
}
@parser.parse('Resource["title1","title2"] { param => value }')
end
-
+
end
-
+
describe Puppet::Parser, "when parsing if statements" do
it "should not raise errors with empty if" do
@@ -172,7 +172,7 @@ describe Puppet::Parser do
lambda { @parser.parse("$a = [1,2,]") }.should_not raise_error
end
end
-
+
describe Puppet::Parser, "when instantiating class of same name" do
before :each do