diff options
Diffstat (limited to 'spec/unit/parser/functions/split_spec.rb')
-rwxr-xr-x | spec/unit/parser/functions/split_spec.rb | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/spec/unit/parser/functions/split_spec.rb b/spec/unit/parser/functions/split_spec.rb index d76c253b0..a1c83bb0f 100755 --- a/spec/unit/parser/functions/split_spec.rb +++ b/spec/unit/parser/functions/split_spec.rb @@ -4,46 +4,46 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe "the split function" do - before :each do - @scope = Puppet::Parser::Scope.new - end - - it "should exist" do - Puppet::Parser::Functions.function("split").should == "function_split" - end - - it "should raise a ParseError if there is less than 2 arguments" do - lambda { @scope.function_split(["foo"]) }.should( raise_error(Puppet::ParseError)) - end - - it "should raise a ParseError if there is more than 2 arguments" do - lambda { @scope.function_split(["foo", "bar", "gazonk"]) }.should( raise_error(Puppet::ParseError)) - end - - it "should raise a RegexpError if the regexp is malformed" do - lambda { @scope.function_split(["foo", "("]) }.should( - raise_error(RegexpError)) - end - - - it "should handle simple string without metacharacters" do - result = @scope.function_split([ "130;236;254;10", ";"]) - result.should(eql(["130", "236", "254", "10"])) - end - - it "should handle simple regexps" do - result = @scope.function_split([ "130.236;254.;10", "[.;]+"]) - result.should(eql(["130", "236", "254", "10"])) - end - - it "should handle groups" do - result = @scope.function_split([ "130.236;254.;10", "([.;]+)"]) - result.should(eql(["130", ".", "236", ";", "254", ".;", "10"])) - end - - it "should handle simple string without metacharacters" do - result = @scope.function_split([ "130.236.254.10", ";"]) - result.should(eql(["130.236.254.10"])) - end + before :each do + @scope = Puppet::Parser::Scope.new + end + + it "should exist" do + Puppet::Parser::Functions.function("split").should == "function_split" + end + + it "should raise a ParseError if there is less than 2 arguments" do + lambda { @scope.function_split(["foo"]) }.should( raise_error(Puppet::ParseError)) + end + + it "should raise a ParseError if there is more than 2 arguments" do + lambda { @scope.function_split(["foo", "bar", "gazonk"]) }.should( raise_error(Puppet::ParseError)) + end + + it "should raise a RegexpError if the regexp is malformed" do + lambda { @scope.function_split(["foo", "("]) }.should( + raise_error(RegexpError)) + end + + + it "should handle simple string without metacharacters" do + result = @scope.function_split([ "130;236;254;10", ";"]) + result.should(eql(["130", "236", "254", "10"])) + end + + it "should handle simple regexps" do + result = @scope.function_split([ "130.236;254.;10", "[.;]+"]) + result.should(eql(["130", "236", "254", "10"])) + end + + it "should handle groups" do + result = @scope.function_split([ "130.236;254.;10", "([.;]+)"]) + result.should(eql(["130", ".", "236", ";", "254", ".;", "10"])) + end + + it "should handle simple string without metacharacters" do + result = @scope.function_split([ "130.236.254.10", ";"]) + result.should(eql(["130.236.254.10"])) + end end |