summaryrefslogtreecommitdiff
path: root/libgo/go/html/template/js_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/html/template/js_test.go')
-rw-r--r--libgo/go/html/template/js_test.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/libgo/go/html/template/js_test.go b/libgo/go/html/template/js_test.go
index 7af7997de9b..7484f60b54d 100644
--- a/libgo/go/html/template/js_test.go
+++ b/libgo/go/html/template/js_test.go
@@ -332,6 +332,25 @@ func TestEscapersOnLower7AndSelectHighCodepoints(t *testing.T) {
}
}
+func TestIsJsMimeType(t *testing.T) {
+ tests := []struct {
+ in string
+ out bool
+ }{
+ {"application/javascript;version=1.8", true},
+ {"application/javascript;version=1.8;foo=bar", true},
+ {"application/javascript/version=1.8", false},
+ {"text/javascript", true},
+ {"application/json", true},
+ }
+
+ for _, test := range tests {
+ if isJSType(test.in) != test.out {
+ t.Errorf("isJSType(%q) = %v, want %v", test.in, !test.out, test.out)
+ }
+ }
+}
+
func BenchmarkJSValEscaperWithNum(b *testing.B) {
for i := 0; i < b.N; i++ {
jsValEscaper(3.141592654)