forked from DHowett/go-plist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinvalid_text_test.go
44 lines (41 loc) · 887 Bytes
/
invalid_text_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package plist
import (
"strings"
"testing"
)
var InvalidTextPlists = []string{
"(/",
"{/",
"<*I>",
"{0=(/",
"(((/",
"{0=/",
"{0=((/",
"/",
"{0=((((/",
"({/",
"(<*I5>,<*I5>,<*I5>,<*I5>,*I16777215>,<*I268435455>,<*I4294967295>,<*I18446744073709551615>,)",
"{0=(((/",
"(<*I>",
"<>",
"((((/",
"((/",
"(<>",
"{¬=A;}", // that character should be in quotes for goth GNUStep and OpenStep
`{"A"A;}`, // there should be an = between "A" and A
`{"A"=A}`, // there should be a ; at the end of the dictionary
"<*F33>", // invalid GNUstep type F
"<EQ>", // invalid data that isn't hex
}
func TestInvalidTextPlists(t *testing.T) {
for _, data := range InvalidTextPlists {
var obj interface{}
buf := strings.NewReader(data)
err := NewDecoder(buf).Decode(&obj)
if err == nil {
t.Fatal("invalid plist failed to throw error")
} else {
t.Log(err)
}
}
}