package xml // import "github.com/tdewolff/parse/xml" import ( "bytes" "fmt" "io" "testing" "github.com/tdewolff/parse" "github.com/tdewolff/test" ) type TTs []TokenType func TestTokens(t *testing.T) { var tokenTests = []struct { xml string expected []TokenType }{ {"", TTs{}}, {"", TTs{CommentToken}}, {"", TTs{CommentToken}}, {"", TTs{StartTagToken, StartTagCloseVoidToken}}, {"", TTs{StartTagToken, StartTagCloseVoidToken}}, {"", TTs{StartTagToken, StartTagCloseVoidToken}}, {"", TTs{StartTagToken, StartTagCloseToken, EndTagToken}}, {"text", TTs{StartTagToken, StartTagCloseToken, TextToken, EndTagToken}}, {" text", TTs{StartTagToken, StartTagCloseVoidToken, TextToken}}, {" text ", TTs{StartTagToken, StartTagCloseToken, TextToken, StartTagToken, StartTagCloseToken, TextToken, StartTagToken, StartTagCloseToken, TextToken, EndTagToken, TextToken, EndTagToken, TextToken, EndTagToken}}, {"", TTs{StartTagToken, AttributeToken, AttributeToken, AttributeToken, StartTagCloseVoidToken}}, {"", TTs{StartTagToken, AttributeToken, StartTagCloseVoidToken}}, {"", TTs{StartTagToken, AttributeToken, StartTagCloseVoidToken}}, {"\"' />", TTs{StartTagToken, AttributeToken, AttributeToken, StartTagCloseVoidToken}}, {"", TTs{StartTagPIToken, StartTagClosePIToken}}, {"", TTs{StartTagPIToken, AttributeToken, StartTagClosePIToken}}, {"", TTs{StartTagPIToken, AttributeToken, StartTagClosePIToken}}, {"", TTs{CDATAToken}}, {"", TTs{DOCTYPEToken}}, {"", TTs{DOCTYPEToken}}, {` W3Schools.">]>`, TTs{DOCTYPEToken}}, {"", TTs{StartTagToken, StartTagCloseToken}}, // early endings {"