OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgo/] [go/] [exp/] [html/] [token_test.go] - Blame information for rev 747

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 747 jeremybenn
// Copyright 2010 The Go Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style
3
// license that can be found in the LICENSE file.
4
 
5
package html
6
 
7
import (
8
        "bytes"
9
        "io"
10
        "strings"
11
        "testing"
12
)
13
 
14
type tokenTest struct {
15
        // A short description of the test case.
16
        desc string
17
        // The HTML to parse.
18
        html string
19
        // The string representations of the expected tokens, joined by '$'.
20
        golden string
21
}
22
 
23
var tokenTests = []tokenTest{
24
        {
25
                "empty",
26
                "",
27
                "",
28
        },
29
        // A single text node. The tokenizer should not break text nodes on whitespace,
30
        // nor should it normalize whitespace within a text node.
31
        {
32
                "text",
33
                "foo  bar",
34
                "foo  bar",
35
        },
36
        // An entity.
37
        {
38
                "entity",
39
                "one < two",
40
                "one < two",
41
        },
42
        // A start, self-closing and end tag. The tokenizer does not care if the start
43
        // and end tokens don't match; that is the job of the parser.
44
        {
45
                "tags",
46
                "bd",
47
                "$b$$d$",
48
        },
49
        // Angle brackets that aren't a tag.
50
        {
51
                "not a tag #0",
52
                "<",
53
                "<",
54
        },
55
        {
56
                "not a tag #1",
57
                "
58
                "</",
59
        },
60
        {
61
                "not a tag #2",
62
                "",
63
                "",
64
        },
65
        {
66
                "not a tag #3",
67
                "ab",
68
                "a$b",
69
        },
70
        {
71
                "not a tag #4",
72
                "",
73
                "",
74
        },
75
        {
76
                "not a tag #5",
77
                "
78
                "",
79
        },
80
        {
81
                "not a tag #6",
82
                "",
83
                "",
84
        },
85
        {
86
                "not a tag #7",
87
                "a < b",
88
                "a < b",
89
        },
90
        {
91
                "not a tag #8",
92
                "<.>",
93
                "<.>",
94
        },
95
        {
96
                "not a tag #9",
97
                "a<<>>c",
98
                "a<<$$>>c",
99
        },
100
        {
101
                "not a tag #10",
102
                "if x<0 and y < 0 then x*y>0",
103
                "if x<0 and y < 0 then x*y>0",
104
        },
105
        // EOF in a tag name.
106
        {
107
                "tag name eof #0",
108
                "
109
                "",
110
        },
111
        {
112
                "tag name eof #1",
113
                "
114
                "",
115
        },
116
        {
117
                "tag name eof #2",
118
                "a
119
                "a",
120
        },
121
        {
122
                "tag name eof #3",
123
                "
124
                "",
125
        },
126
        {
127
                "tag name eof #4",
128
                `
129
                ``,
130
        },
131
        // Some malformed tags that are missing a '>'.
132
        {
133
                "malformed tag #0",
134
                ``,
135
                ``,
136
        },
137
        {
138
                "malformed tag #1",
139
                `

`,

140
                `

`,

141
        },
142
        {
143
                "malformed tag #2",
144
                `

145
                `

`,

146
        },
147
        {
148
                "malformed tag #3",
149
                `

150
                `

`,

151
        },
152
        {
153
                "malformed tag #4",
154
                `

`,

155
                `

`,

156
        },
157
        {
158
                "malformed tag #5",
159
                `

160
                `

`,

161
        },
162
        {
163
                "malformed tag #6",
164
                `

`,

165
                `

`,

166
        },
167
        {
168
                "malformed tag #7",
169
                `

170
                `

`,

171
        },
172
        {
173
                "malformed tag #8",
174
                `

`,

175
                `

`,

176
        },
177
        // Raw text and RCDATA.
178
        {
179
                "basic raw text",
180
                "",
181
                "",
182
        },
183
        {
184
                "unfinished script end tag",
185
                "
206
                "",
207
        },
208
        {
209
                "'>' completes script end tag",
210
                "",
211
                "",
212
        },
213
        {
214
                "self-closing script end tag",
215
                "",
216
                "",
217
        },
218
        {
219
                "nested script tag",
220
                "",
226
                "",
227
        },
228
        {
229
                "script/style mismatched tags",
230
                "



powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.