From 354da79bb2edaa1af7d909d2774e7d67eb4e198c Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Tue, 23 Jan 2018 18:17:51 +0100 Subject: Add vendor --- vendor/golang.org/x/net/html/token_test.go | 748 +++++++++++++++++++++++++++++ 1 file changed, 748 insertions(+) create mode 100644 vendor/golang.org/x/net/html/token_test.go (limited to 'vendor/golang.org/x/net/html/token_test.go') diff --git a/vendor/golang.org/x/net/html/token_test.go b/vendor/golang.org/x/net/html/token_test.go new file mode 100644 index 0000000..20221c3 --- /dev/null +++ b/vendor/golang.org/x/net/html/token_test.go @@ -0,0 +1,748 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package html + +import ( + "bytes" + "io" + "io/ioutil" + "reflect" + "runtime" + "strings" + "testing" +) + +type tokenTest struct { + // A short description of the test case. + desc string + // The HTML to parse. + html string + // The string representations of the expected tokens, joined by '$'. + golden string +} + +var tokenTests = []tokenTest{ + { + "empty", + "", + "", + }, + // A single text node. The tokenizer should not break text nodes on whitespace, + // nor should it normalize whitespace within a text node. + { + "text", + "foo bar", + "foo bar", + }, + // An entity. + { + "entity", + "one < two", + "one < two", + }, + // A start, self-closing and end tag. The tokenizer does not care if the start + // and end tokens don't match; that is the job of the parser. + { + "tags", + "bd", + "$b$$d$", + }, + // Angle brackets that aren't a tag. + { + "not a tag #0", + "<", + "<", + }, + { + "not a tag #1", + "", + "", + }, + { + "not a tag #3", + "ab", + "a$$b", + }, + { + "not a tag #4", + "", + "", + }, + { + "not a tag #5", + "", + }, + { + "not a tag #6", + "", + "", + }, + { + "not a tag #7", + "a < b", + "a < b", + }, + { + "not a tag #8", + "<.>", + "<.>", + }, + { + "not a tag #9", + "a<<>>c", + "a<<$$>>c", + }, + { + "not a tag #10", + "if x<0 and y < 0 then x*y>0", + "if x<0 and y < 0 then x*y>0", + }, + { + "not a tag #11", + "<

", + "<$

", + }, + // EOF in a tag name. + { + "tag name eof #0", + "", + }, + { + "tag name eof #4", + `'. + { + "malformed tag #0", + ``, + ``, + }, + { + "malformed tag #1", + `

`, + `

`, + }, + { + "malformed tag #2", + `

`, + `

`, + }, + { + "malformed tag #5", + `

`, + `

`, + }, + { + "malformed tag #7", + `

`, + `

`, + }, + { + "malformed tag #9", + `

`, + }, + // Raw text and RCDATA. + { + "basic raw text", + "", + "", + }, + { + "unfinished script end tag", + "$a", + }, + { + "'>' completes script end tag", + "", + "", + }, + { + "self-closing script end tag", + "", + "", + }, + { + "nested script tag", + "", + "", + }, + { + "script/style mismatched tags", + "