summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser/functions/regsubst.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/parser/functions/regsubst.rb')
-rw-r--r--spec/unit/parser/functions/regsubst.rb84
1 files changed, 42 insertions, 42 deletions
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