mirror of
https://github.com/Luzifer/nginx-sso.git
synced 2024-12-21 05:11:17 +00:00
30 lines
501 B
Go
30 lines
501 B
Go
|
package pongo2_test
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/flosch/pongo2"
|
||
|
)
|
||
|
|
||
|
func TestIssue151(t *testing.T) {
|
||
|
tpl, err := pongo2.FromString("{{ mydict.51232_3 }}{{ 12345_123}}{{ 995189baz }}")
|
||
|
if err != nil {
|
||
|
t.Fatal(err)
|
||
|
}
|
||
|
|
||
|
str, err := tpl.Execute(pongo2.Context{
|
||
|
"mydict": map[string]string{
|
||
|
"51232_3": "foo",
|
||
|
},
|
||
|
"12345_123": "bar",
|
||
|
"995189baz": "baz",
|
||
|
})
|
||
|
if err != nil {
|
||
|
t.Fatal(err)
|
||
|
}
|
||
|
|
||
|
if str != "foobarbaz" {
|
||
|
t.Fatalf("Expected output 'foobarbaz', but got '%s'.", str)
|
||
|
}
|
||
|
}
|