(c *C)
| 36 | } |
| 37 | |
| 38 | func (s *TestSuite) TestMisc(c *C) { |
| 39 | // Must |
| 40 | // TODO: Add better error message (see issue #18) |
| 41 | c.Check( |
| 42 | func() { pongo2.Must(testSuite2.FromFile("template_tests/inheritance/base2.tpl")) }, |
| 43 | PanicMatches, |
| 44 | `\[Error \(where: fromfile\) in .*template_tests[/\\]inheritance[/\\]doesnotexist.tpl | Line 1 Col 12 near 'doesnotexist.tpl'\] open .*template_tests[/\\]inheritance[/\\]doesnotexist.tpl: no such file or directory`, |
| 45 | ) |
| 46 | |
| 47 | // Context |
| 48 | c.Check(parseTemplateFn("", pongo2.Context{"'illegal": nil}), PanicMatches, ".*not a valid identifier.*") |
| 49 | |
| 50 | // Registers |
| 51 | c.Check(pongo2.RegisterFilter("escape", nil).Error(), Matches, ".*is already registered") |
| 52 | c.Check(pongo2.RegisterTag("for", nil).Error(), Matches, ".*is already registered") |
| 53 | |
| 54 | // ApplyFilter |
| 55 | v, err := pongo2.ApplyFilter("title", pongo2.AsValue("this is a title"), nil) |
| 56 | if err != nil { |
| 57 | c.Fatal(err) |
| 58 | } |
| 59 | c.Check(v.String(), Equals, "This Is A Title") |
| 60 | c.Check(func() { |
| 61 | _, err := pongo2.ApplyFilter("doesnotexist", nil, nil) |
| 62 | if err != nil { |
| 63 | panic(err) |
| 64 | } |
| 65 | }, PanicMatches, `\[Error \(where: applyfilter\)\] filter with name 'doesnotexist' not found`) |
| 66 | } |
| 67 | |
| 68 | func (s *TestSuite) TestImplicitExecCtx(c *C) { |
| 69 | tpl, err := pongo2.FromString("{{ ImplicitExec }}") |
nothing calls this directly
no test coverage detected