I'd prefer this be squashed into the other commit - I like having code and tests in the same commit if possible.
Otherwise, +1 On May 20, 2009, at 11:18 AM, Thomas Bellman wrote: > > Signed-off-by: Thomas Bellman <[email protected]> > --- > spec/unit/parser/functions/split.rb | 35 +++++++++++++++++++++++++ > ++++++++++ > 1 files changed, 35 insertions(+), 0 deletions(-) > create mode 100755 spec/unit/parser/functions/split.rb > > diff --git a/spec/unit/parser/functions/split.rb b/spec/unit/parser/ > functions/split.rb > new file mode 100755 > index 0000000..7f96d5d > --- /dev/null > +++ b/spec/unit/parser/functions/split.rb > @@ -0,0 +1,35 @@ > +#! /usr/bin/env ruby > + > +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 handle a simple string" do > + result = @scope.function_split([ "130;236;254;10", ";"]) > + result.should(eql(["130", "236", "254", "10"])) > + end > + > + it "should not interpret the second argument as a regexp" do > + result = @scope.function_split([ "130.236;254[.;]10", > "[.;]"]) > + result.should(eql(["130.236;254", "10"])) > + end > + > +end > -- > 1.6.0.6 > > > -- It's a small world, but I wouldn't want to paint it. -- Stephen Wright --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en -~----------~----~----~----~------~----~------~--~---
