Working now

This commit is contained in:
Wheeler Law 2018-08-15 22:31:55 -04:00 committed by Megan Marsh
parent 65c1b039cc
commit de3bdec567
2 changed files with 6 additions and 6 deletions

View File

@ -257,14 +257,14 @@ func funcGenVault(ctx *Context) interface{} {
}
func funcGenSed(ctx *Context) interface{} {
return func(k string, expr string) (string, error) {
engine, err := sed.NewQuiet(strings.NewReader(expr))
return func(inputString string, expression string) (string, error) {
engine, err := sed.New(strings.NewReader(expression))
if err != nil {
return "", err
}
result, err := engine.RunString(k)
result, err := engine.RunString(inputString)
return result, err
}

View File

@ -322,17 +322,17 @@ func TestFuncSed(t *testing.T) {
Output string
}{
{
`{{sed "hello" "s/hello/world/"}}`,
`{{sed "hello" "s|hello|world|"}}`,
`world`,
},
{
`{{sed "hello" "s/foo/bar/"}}`,
`{{sed "hello" "s|foo|bar|"}}`,
`hello`,
},
{
`{{user "foo" | sed "s/foo/bar/"}}`,
`{{user "foo" | sed "s|foo|bar|"}}`,
`bar`,
},
}