Rewrite simple test (only grpc output)
This commit is contained in:
69
vendor/github.com/Masterminds/sprig/functions_test.go
generated
vendored
69
vendor/github.com/Masterminds/sprig/functions_test.go
generated
vendored
@@ -12,7 +12,6 @@ import (
|
||||
"text/template"
|
||||
|
||||
"github.com/aokoli/goutils"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
// This is woefully incomplete. Please help.
|
||||
@@ -285,16 +284,6 @@ func TestEmpty(t *testing.T) {
|
||||
if err := runt(tpl, "1"); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
dict := map[string]interface{}{"top": map[string]interface{}{}}
|
||||
tpl = `{{if empty .top.NoSuchThing}}1{{else}}0{{end}}`
|
||||
if err := runtv(tpl, "1", dict); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
tpl = `{{if empty .bottom.NoSuchThing}}1{{else}}0{{end}}`
|
||||
if err := runtv(tpl, "1", dict); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSplit(t *testing.T) {
|
||||
@@ -533,43 +522,6 @@ func TestDict(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnset(t *testing.T) {
|
||||
tpl := `{{- $d := dict "one" 1 "two" 222222 -}}
|
||||
{{- $_ := unset $d "two" -}}
|
||||
{{- range $k, $v := $d}}{{$k}}{{$v}}{{- end -}}
|
||||
`
|
||||
|
||||
expect := "one1"
|
||||
if err := runt(tpl, expect); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
func TestHasKey(t *testing.T) {
|
||||
tpl := `{{- $d := dict "one" 1 "two" 222222 -}}
|
||||
{{- if hasKey $d "one" -}}1{{- end -}}
|
||||
`
|
||||
|
||||
expect := "1"
|
||||
if err := runt(tpl, expect); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSet(t *testing.T) {
|
||||
tpl := `{{- $d := dict "one" 1 "two" 222222 -}}
|
||||
{{- $_ := set $d "two" 2 -}}
|
||||
{{- $_ := set $d "three" 3 -}}
|
||||
{{- if hasKey $d "one" -}}{{$d.one}}{{- end -}}
|
||||
{{- if hasKey $d "two" -}}{{$d.two}}{{- end -}}
|
||||
{{- if hasKey $d "three" -}}{{$d.three}}{{- end -}}
|
||||
`
|
||||
|
||||
expect := "123"
|
||||
if err := runt(tpl, expect); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUntil(t *testing.T) {
|
||||
tests := map[string]string{
|
||||
`{{range $i, $e := until 5}}{{$i}}{{$e}}{{end}}`: "0011223344",
|
||||
@@ -599,27 +551,6 @@ func TestUntilStep(t *testing.T) {
|
||||
|
||||
}
|
||||
|
||||
func TestBase(t *testing.T) {
|
||||
assert.NoError(t, runt(`{{ base "foo/bar" }}`, "bar"))
|
||||
}
|
||||
|
||||
func TestDir(t *testing.T) {
|
||||
assert.NoError(t, runt(`{{ dir "foo/bar/baz" }}`, "foo/bar"))
|
||||
}
|
||||
|
||||
func TestIsAbs(t *testing.T) {
|
||||
assert.NoError(t, runt(`{{ isAbs "/foo" }}`, "true"))
|
||||
assert.NoError(t, runt(`{{ isAbs "foo" }}`, "false"))
|
||||
}
|
||||
|
||||
func TestClean(t *testing.T) {
|
||||
assert.NoError(t, runt(`{{ clean "/foo/../foo/../bar" }}`, "/bar"))
|
||||
}
|
||||
|
||||
func TestExt(t *testing.T) {
|
||||
assert.NoError(t, runt(`{{ ext "/foo/bar/baz.txt" }}`, ".txt"))
|
||||
}
|
||||
|
||||
func TestDelete(t *testing.T) {
|
||||
fmap := TxtFuncMap()
|
||||
delete(fmap, "split")
|
||||
|
Reference in New Issue
Block a user