diff options
| author | Ian Taylor <ian@lorf.org> | 2009-06-05 12:38:35 -0400 |
|---|---|---|
| committer | James Turnbull <james@lovedthanlost.net> | 2009-06-06 09:11:28 +1000 |
| commit | 41ce18cc8ea239d1633fc6cd9e9f599957a82e74 (patch) | |
| tree | 9d398b4e3e6d726a174b5b57094c7dd6749ccf0e /spec/unit/parser | |
| parent | f3b40923605420f774dac298fb1708de180c0a81 (diff) | |
| download | puppet-41ce18cc8ea239d1633fc6cd9e9f599957a82e74.tar.gz puppet-41ce18cc8ea239d1633fc6cd9e9f599957a82e74.tar.xz puppet-41ce18cc8ea239d1633fc6cd9e9f599957a82e74.zip | |
Changed tabs to spaces without interfering with indentation or alignment
Diffstat (limited to 'spec/unit/parser')
| -rwxr-xr-x | spec/unit/parser/ast/arithmetic_operator.rb | 30 | ||||
| -rwxr-xr-x | spec/unit/parser/ast/boolean_operator.rb | 2 | ||||
| -rw-r--r-- | spec/unit/parser/functions/regsubst.rb | 84 | ||||
| -rw-r--r-- | spec/unit/parser/functions/sprintf.rb | 22 | ||||
| -rwxr-xr-x | spec/unit/parser/parser.rb | 6 |
5 files changed, 72 insertions, 72 deletions
diff --git a/spec/unit/parser/ast/arithmetic_operator.rb b/spec/unit/parser/ast/arithmetic_operator.rb index ce6d42faf..9c1ff864e 100755 --- a/spec/unit/parser/ast/arithmetic_operator.rb +++ b/spec/unit/parser/ast/arithmetic_operator.rb @@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe Puppet::Parser::AST::ArithmeticOperator do - ast = Puppet::Parser::AST + ast = Puppet::Parser::AST before :each do @scope = Puppet::Parser::Scope.new() @@ -27,24 +27,24 @@ describe Puppet::Parser::AST::ArithmeticOperator do end it "should call Puppet::Parser::Scope.number?" do - Puppet::Parser::Scope.expects(:number?).with(1).returns(1) - Puppet::Parser::Scope.expects(:number?).with(2).returns(2) - + Puppet::Parser::Scope.expects(:number?).with(1).returns(1) + Puppet::Parser::Scope.expects(:number?).with(2).returns(2) + ast::ArithmeticOperator.new(:lval => @one, :operator => "+", :rval => @two).evaluate(@scope) end - %w{ + - * / << >>}.each do |op| - it "should call ruby Numeric '#{op}'" do - one = stub 'one' - two = stub 'two' - operator = ast::ArithmeticOperator.new :lval => @one, :operator => op, :rval => @two - Puppet::Parser::Scope.stubs(:number?).with(1).returns(one) - Puppet::Parser::Scope.stubs(:number?).with(2).returns(two) - one.expects(:send).with(op,two) - operator.evaluate(@scope) - end - end + %w{ + - * / << >>}.each do |op| + it "should call ruby Numeric '#{op}'" do + one = stub 'one' + two = stub 'two' + operator = ast::ArithmeticOperator.new :lval => @one, :operator => op, :rval => @two + Puppet::Parser::Scope.stubs(:number?).with(1).returns(one) + Puppet::Parser::Scope.stubs(:number?).with(2).returns(two) + one.expects(:send).with(op,two) + operator.evaluate(@scope) + end + end it "should work even with numbers embedded in strings" do two = stub 'two', :safeevaluate => "2" diff --git a/spec/unit/parser/ast/boolean_operator.rb b/spec/unit/parser/ast/boolean_operator.rb index 98e173bf0..13f5e6530 100755 --- a/spec/unit/parser/ast/boolean_operator.rb +++ b/spec/unit/parser/ast/boolean_operator.rb @@ -16,7 +16,7 @@ describe Puppet::Parser::AST::BooleanOperator do lval = stub "lval" lval.expects(:safeevaluate).with(@scope).returns("true") rval = stub "rval", :safeevaluate => false - rval.expects(:safeevaluate).never + rval.expects(:safeevaluate).never operator = ast::BooleanOperator.new :rval => rval, :operator => "or", :lval => lval operator.evaluate(@scope) diff --git a/spec/unit/parser/functions/regsubst.rb b/spec/unit/parser/functions/regsubst.rb index 18f49f7d4..0e80ec798 100644 --- a/spec/unit/parser/functions/regsubst.rb +++ b/spec/unit/parser/functions/regsubst.rb @@ -14,75 +14,75 @@ describe "the regsubst function" do it "should raise a ParseError if there is less than 3 arguments" do lambda { @scope.function_regsubst(["foo", "bar"]) }.should( - raise_error(Puppet::ParseError)) + raise_error(Puppet::ParseError)) end it "should raise a ParseError if there is more than 5 arguments" do lambda { @scope.function_regsubst(["foo", "bar", "gazonk", "del", "x", "y"]) }.should( - raise_error(Puppet::ParseError)) + raise_error(Puppet::ParseError)) end it "should raise a ParseError when given a bad flag" do lambda { @scope.function_regsubst(["foo", "bar", "gazonk", "X"]) }.should( - raise_error(Puppet::ParseError)) + raise_error(Puppet::ParseError)) end it "should handle groups" do - result = @scope.function_regsubst( - [ '130.236.254.10', - '^([0-9]+)[.]([0-9]+)[.]([0-9]+)[.]([0-9]+)$', - '\4-\3-\2-\1' - ]) - result.should(eql("10-254-236-130")) + result = @scope.function_regsubst( + [ '130.236.254.10', + '^([0-9]+)[.]([0-9]+)[.]([0-9]+)[.]([0-9]+)$', + '\4-\3-\2-\1' + ]) + result.should(eql("10-254-236-130")) end it "should handle simple regexps" do - result = @scope.function_regsubst( - [ "the monkey breaks banana trees", - "b[an]*a", - "coconut" - ]) - result.should(eql("the monkey breaks coconut trees")) + result = @scope.function_regsubst( + [ "the monkey breaks banana trees", + "b[an]*a", + "coconut" + ]) + result.should(eql("the monkey breaks coconut trees")) end it "should handle case-sensitive regexps" do - result = @scope.function_regsubst( - [ "the monkey breaks baNAna trees", - "b[an]+a", - "coconut" - ]) - result.should(eql("the monkey breaks baNAna trees")) + result = @scope.function_regsubst( + [ "the monkey breaks baNAna trees", + "b[an]+a", + "coconut" + ]) + result.should(eql("the monkey breaks baNAna trees")) end it "should handle case-insensitive regexps" do - result = @scope.function_regsubst( - [ "the monkey breaks baNAna trees", - "b[an]+a", - "coconut", - "I" - ]) - result.should(eql("the monkey breaks coconut trees")) + result = @scope.function_regsubst( + [ "the monkey breaks baNAna trees", + "b[an]+a", + "coconut", + "I" + ]) + result.should(eql("the monkey breaks coconut trees")) end it "should handle global substitutions" do - result = @scope.function_regsubst( - [ "the monkey breaks\tbanana trees", - "[ \t]", - "--", - "G" - ]) - result.should(eql("the--monkey--breaks--banana--trees")) + result = @scope.function_regsubst( + [ "the monkey breaks\tbanana trees", + "[ \t]", + "--", + "G" + ]) + result.should(eql("the--monkey--breaks--banana--trees")) end it "should handle global substitutions with groups" do - result = @scope.function_regsubst( - [ '130.236.254.10', - '([0-9]+)', - '<\1>', - 'G' - ]) - result.should(eql('<130>.<236>.<254>.<10>')) + result = @scope.function_regsubst( + [ '130.236.254.10', + '([0-9]+)', + '<\1>', + 'G' + ]) + result.should(eql('<130>.<236>.<254>.<10>')) end end diff --git a/spec/unit/parser/functions/sprintf.rb b/spec/unit/parser/functions/sprintf.rb index 8654b18fc..949dc3fcc 100644 --- a/spec/unit/parser/functions/sprintf.rb +++ b/spec/unit/parser/functions/sprintf.rb @@ -14,29 +14,29 @@ describe "the sprintf function" do it "should raise a ParseError if there is less than 1 argument" do lambda { @scope.function_sprintf([]) }.should( - raise_error(Puppet::ParseError)) + raise_error(Puppet::ParseError)) end it "should format integers" do - result = @scope.function_sprintf(["%+05d", "23"]) - result.should(eql("+0023")) + result = @scope.function_sprintf(["%+05d", "23"]) + result.should(eql("+0023")) end it "should format floats" do - result = @scope.function_sprintf(["%+.2f", "2.7182818284590451"]) - result.should(eql("+2.72")) + result = @scope.function_sprintf(["%+.2f", "2.7182818284590451"]) + result.should(eql("+2.72")) end it "should format large floats" do - result = @scope.function_sprintf(["%+.2e", "27182818284590451"]) - result.should(eql("+2.72e+16")) + result = @scope.function_sprintf(["%+.2e", "27182818284590451"]) + result.should(eql("+2.72e+16")) end it "should perform more complex formatting" do - result = @scope.function_sprintf( - [ "<%.8s:%#5o %#8X (%-8s)>", - "overlongstring", "23", "48879", "foo" ]) - result.should(eql("<overlong: 027 0XBEEF (foo )>")) + result = @scope.function_sprintf( + [ "<%.8s:%#5o %#8X (%-8s)>", + "overlongstring", "23", "48879", "foo" ]) + result.should(eql("<overlong: 027 0XBEEF (foo )>")) end end diff --git a/spec/unit/parser/parser.rb b/spec/unit/parser/parser.rb index b764dee97..ef05bc876 100755 --- a/spec/unit/parser/parser.rb +++ b/spec/unit/parser/parser.rb @@ -162,11 +162,11 @@ describe Puppet::Parser do it "should not raise errors with multiple arguments and a trailing comma" do lambda { @parser.parse("notice(1,2,)") }.should_not raise_error - end + end - end + end - describe Puppet::Parser, "when parsing arrays with trailing comma" do + describe Puppet::Parser, "when parsing arrays with trailing comma" do it "should not raise errors with a trailing comma" do lambda { @parser.parse("$a = [1,2,]") }.should_not raise_error |
