1
0
Fork 0
mirror of https://github.com/alice-lg/birdwatcher.git synced 2025-03-16 00:00:08 +01:00
birdwatcher/bird/utils_test.go
2017-07-14 15:42:45 +02:00

26 lines
414 B
Go

package bird
import (
"testing"
)
func TestTemplateExpand(t *testing.T) {
// Expect input to be something like
// TEST_FOO_42_src
//
// Template:
// RESULT_$1
//
// Result:
// RESULT_FOO_42
//
src := "TEST_FOO_42_src"
expr := `TEST_(.*)_src`
tmpl := "RESULT_${1}_${1}"
res := TemplateExpand(expr, tmpl, src)
if res != "RESULT_FOO_42_FOO_42" {
t.Error("Unexpacted expansion:", res)
}
}