diff options
Diffstat (limited to 'libgo/go/html/template/escape_test.go')
-rw-r--r-- | libgo/go/html/template/escape_test.go | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/libgo/go/html/template/escape_test.go b/libgo/go/html/template/escape_test.go index 707394e3b0..f6ace496e7 100644 --- a/libgo/go/html/template/escape_test.go +++ b/libgo/go/html/template/escape_test.go @@ -903,7 +903,7 @@ func TestErrors(t *testing.T) { }, { `<a href="{{if .F}}/foo?a={{else}}/bar/{{end}}{{.H}}">`, - "z:1:47: {{.H}} appears in an ambiguous URL context", + "z:1:47: {{.H}} appears in an ambiguous context within a URL", }, { `<a onclick="alert('Hello \`, @@ -990,7 +990,7 @@ func TestErrors(t *testing.T) { } continue } - if strings.Index(got, test.err) == -1 { + if !strings.Contains(got, test.err) { t.Errorf("input=%q: error\n\t%q\ndoes not contain expected string\n\t%q", test.input, got, test.err) continue } @@ -1365,6 +1365,10 @@ func TestEscapeText(t *testing.T) { context{state: stateTag, element: elementScript}, }, { + `<script>`, + context{state: stateJS, jsCtx: jsCtxRegexp, element: elementScript}, + }, + { `<script>foo`, context{state: stateJS, jsCtx: jsCtxDivOp, element: elementScript}, }, @@ -1389,6 +1393,14 @@ func TestEscapeText(t *testing.T) { context{state: stateText}, }, { + `<script type="text/template">`, + context{state: stateText}, + }, + { + `<script type="notjs">`, + context{state: stateText}, + }, + { `<Script>`, context{state: stateJS, element: elementScript}, }, |