diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-09-24 07:38:19 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-09-24 07:38:19 +0000 |
commit | b7459437aef76ee975ddd0e969077c7c1c77aa13 (patch) | |
tree | 3d61b51956e0e99640086b8707875344e2e74bbc /libgo | |
parent | aca21847a28e296d86dae8f53863487378926c6d (diff) | |
download | gcc-b7459437aef76ee975ddd0e969077c7c1c77aa13.tar.gz |
2011-09-24 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 179138 using svnmerge.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@179139 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo')
48 files changed, 5835 insertions, 44 deletions
diff --git a/libgo/MERGE b/libgo/MERGE index f0849cc1a18..41cab710019 100644 --- a/libgo/MERGE +++ b/libgo/MERGE @@ -1,4 +1,4 @@ -504f4e9b079c +fd30c132d1bd The first line of this file holds the Mercurial revision number of the last merge done from the master library sources. diff --git a/libgo/Makefile.am b/libgo/Makefile.am index 2881c6d7c09..b49a61e7b40 100644 --- a/libgo/Makefile.am +++ b/libgo/Makefile.am @@ -636,7 +636,8 @@ go_json_files = \ go/json/encode.go \ go/json/indent.go \ go/json/scanner.go \ - go/json/stream.go + go/json/stream.go \ + go/json/tags.go go_log_files = \ go/log/log.go diff --git a/libgo/Makefile.in b/libgo/Makefile.in index 41ffe7c7230..9d61859f812 100644 --- a/libgo/Makefile.in +++ b/libgo/Makefile.in @@ -1037,7 +1037,8 @@ go_json_files = \ go/json/encode.go \ go/json/indent.go \ go/json/scanner.go \ - go/json/stream.go + go/json/stream.go \ + go/json/tags.go go_log_files = \ go/log/log.go diff --git a/libgo/go/go/types/testdata/test0.src b/libgo/go/go/types/testdata/test0.src new file mode 100644 index 00000000000..84a1abe2701 --- /dev/null +++ b/libgo/go/go/types/testdata/test0.src @@ -0,0 +1,154 @@ +// Copyright 2011 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. + +// type declarations + +package test0 + +import "unsafe" + +const pi = 3.1415 + +type ( + N undeclared /* ERROR "undeclared" */ + B bool + I int32 + A [10]P + T struct { + x, y P + } + P *T + R (*R) + F func(A) I + Y interface { + f(A) I + } + S [](((P))) + M map[I]F + C chan<- I +) + + +type ( + p1 pi /* ERROR "not a package" */ .foo + p2 unsafe.Pointer +) + + +type ( + Pi pi /* ERROR "not a type" */ + + a /* DISABLED "illegal cycle" */ a + a /* ERROR "redeclared" */ int + + // where the cycle error appears depends on the + // order in which declarations are processed + // (which depends on the order in which a map + // is iterated through) + b c + c /* DISABLED "illegal cycle" */ d + d e + e b + + t *t + + U V + V *W + W U + + P1 *S2 + P2 P1 + + S0 struct { + } + S1 struct { + a, b, c int + u, v, a /* ERROR "redeclared" */ float32 + } + S2 struct { + U // anonymous field + // TODO(gri) recognize double-declaration below + // U /* ERROR "redeclared" */ int + } + S3 struct { + x S2 + } + S4/* DISABLED "illegal cycle" */ struct { + S4 + } + S5 struct { + S6 + } + S6 /* DISABLED "illegal cycle" */ struct { + field S7 + } + S7 struct { + S5 + } + + L1 []L1 + L2 []int + + A1 [10]int + A2 /* DISABLED "illegal cycle" */ [10]A2 + A3 /* DISABLED "illegal cycle" */ [10]struct { + x A4 + } + A4 [10]A3 + + F1 func() + F2 func(x, y, z float32) + F3 func(x, y, x /* ERROR "redeclared" */ float32) + F4 func() (x, y, x /* ERROR "redeclared" */ float32) + F5 func(x int) (x /* ERROR "redeclared" */ float32) + F6 func(x ...int) + + I1 interface{} + I2 interface { + m1() + } + I3 interface { + m1() + m1 /* ERROR "redeclared" */ () + } + I4 interface { + m1(x, y, x /* ERROR "redeclared" */ float32) + m2() (x, y, x /* ERROR "redeclared" */ float32) + m3(x int) (x /* ERROR "redeclared" */ float32) + } + I5 interface { + m1(I5) + } + I6 interface { + S0 /* ERROR "non-interface" */ + } + I7 interface { + I1 + I1 + } + I8 /* DISABLED "illegal cycle" */ interface { + I8 + } + I9 /* DISABLED "illegal cycle" */ interface { + I10 + } + I10 interface { + I11 + } + I11 interface { + I9 + } + + C1 chan int + C2 <-chan int + C3 chan<- C3 + C4 chan C5 + C5 chan C6 + C6 chan C4 + + M1 map[Last]string + M2 map[string]M2 + + Last int +) diff --git a/libgo/go/gob/doc.go b/libgo/go/gob/doc.go index 35d882afb7a..a9284ced7f9 100644 --- a/libgo/go/gob/doc.go +++ b/libgo/go/gob/doc.go @@ -221,6 +221,9 @@ In summary, a gob stream looks like where * signifies zero or more repetitions and the type id of a value must be predefined or be defined before the value in the stream. + +See "Gobs of data" for a design discussion of the gob wire format: +http://blog.golang.org/2011/03/gobs-of-data.html */ package gob diff --git a/libgo/go/html/testdata/webkit/adoption01.dat b/libgo/go/html/testdata/webkit/adoption01.dat new file mode 100644 index 00000000000..787e1b01e19 --- /dev/null +++ b/libgo/go/html/testdata/webkit/adoption01.dat @@ -0,0 +1,194 @@ +#data +<a><p></a></p> +#errors +#document +| <html> +| <head> +| <body> +| <a> +| <p> +| <a> + +#data +<a>1<p>2</a>3</p> +#errors +#document +| <html> +| <head> +| <body> +| <a> +| "1" +| <p> +| <a> +| "2" +| "3" + +#data +<a>1<button>2</a>3</button> +#errors +#document +| <html> +| <head> +| <body> +| <a> +| "1" +| <button> +| <a> +| "2" +| "3" + +#data +<a>1<b>2</a>3</b> +#errors +#document +| <html> +| <head> +| <body> +| <a> +| "1" +| <b> +| "2" +| <b> +| "3" + +#data +<a>1<div>2<div>3</a>4</div>5</div> +#errors +#document +| <html> +| <head> +| <body> +| <a> +| "1" +| <div> +| <a> +| "2" +| <div> +| <a> +| "3" +| "4" +| "5" + +#data +<table><a>1<p>2</a>3</p> +#errors +#document +| <html> +| <head> +| <body> +| <a> +| "1" +| <p> +| <a> +| "2" +| "3" +| <table> + +#data +<b><b><a><p></a> +#errors +#document +| <html> +| <head> +| <body> +| <b> +| <b> +| <a> +| <p> +| <a> + +#data +<b><a><b><p></a> +#errors +#document +| <html> +| <head> +| <body> +| <b> +| <a> +| <b> +| <b> +| <p> +| <a> + +#data +<a><b><b><p></a> +#errors +#document +| <html> +| <head> +| <body> +| <a> +| <b> +| <b> +| <b> +| <b> +| <p> +| <a> + +#data +<p>1<s id="A">2<b id="B">3</p>4</s>5</b> +#errors +#document +| <html> +| <head> +| <body> +| <p> +| "1" +| <s> +| id="A" +| "2" +| <b> +| id="B" +| "3" +| <s> +| id="A" +| <b> +| id="B" +| "4" +| <b> +| id="B" +| "5" + +#data +<table><a>1<td>2</td>3</table> +#errors +#document +| <html> +| <head> +| <body> +| <a> +| "1" +| <a> +| "3" +| <table> +| <tbody> +| <tr> +| <td> +| "2" + +#data +<table>A<td>B</td>C</table> +#errors +#document +| <html> +| <head> +| <body> +| "AC" +| <table> +| <tbody> +| <tr> +| <td> +| "B" + +#data +<a><svg><tr><input></a> +#errors +#document +| <html> +| <head> +| <body> +| <a> +| <svg svg> +| <svg tr> +| <svg input> diff --git a/libgo/go/html/testdata/webkit/adoption02.dat b/libgo/go/html/testdata/webkit/adoption02.dat new file mode 100644 index 00000000000..d18151b44f0 --- /dev/null +++ b/libgo/go/html/testdata/webkit/adoption02.dat @@ -0,0 +1,31 @@ +#data +<b>1<i>2<p>3</b>4 +#errors +#document +| <html> +| <head> +| <body> +| <b> +| "1" +| <i> +| "2" +| <i> +| <p> +| <b> +| "3" +| "4" + +#data +<a><div><style></style><address><a> +#errors +#document +| <html> +| <head> +| <body> +| <a> +| <div> +| <a> +| <style> +| <address> +| <a> +| <a> diff --git a/libgo/go/html/testdata/webkit/html5test-com.dat b/libgo/go/html/testdata/webkit/html5test-com.dat new file mode 100644 index 00000000000..d7cb71db054 --- /dev/null +++ b/libgo/go/html/testdata/webkit/html5test-com.dat @@ -0,0 +1,246 @@ +#data +<div<div> +#errors +#document +| <html> +| <head> +| <body> +| <div<div> + +#data +<div foo<bar=''> +#errors +#document +| <html> +| <head> +| <body> +| <div> +| foo<bar="" + +#data +<div foo=`bar`> +#errors +#document +| <html> +| <head> +| <body> +| <div> +| foo="`bar`" + +#data +<div \"foo=''> +#errors +#document +| <html> +| <head> +| <body> +| <div> +| \"foo="" + +#data +<a href='\nbar'></a> +#errors +#document +| <html> +| <head> +| <body> +| <a> +| href="\nbar" + +#data +<!DOCTYPE html> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> + +#data +⟨⟩ +#errors +#document +| <html> +| <head> +| <body> +| "⟨⟩" + +#data +' +#errors +#document +| <html> +| <head> +| <body> +| "'" + +#data +ⅈ +#errors +#document +| <html> +| <head> +| <body> +| "ⅈ" + +#data +𝕂 +#errors +#document +| <html> +| <head> +| <body> +| "𝕂" + +#data +∉ +#errors +#document +| <html> +| <head> +| <body> +| "∉" + +#data +<?import namespace="foo" implementation="#bar"> +#errors +#document +| <!-- ?import namespace="foo" implementation="#bar" --> +| <html> +| <head> +| <body> + +#data +<!--foo--bar--> +#errors +#document +| <!-- foo--bar --> +| <html> +| <head> +| <body> + +#data +<![CDATA[x]]> +#errors +#document +| <!-- [CDATA[x]] --> +| <html> +| <head> +| <body> + +#data +<textarea><!--</textarea>--></textarea> +#errors +#document +| <html> +| <head> +| <body> +| <textarea> +| "<!--" +| "-->" + +#data +<textarea><!--</textarea>--> +#errors +#document +| <html> +| <head> +| <body> +| <textarea> +| "<!--" +| "-->" + +#data +<style><!--</style>--></style> +#errors +#document +| <html> +| <head> +| <style> +| "<!--" +| <body> +| "-->" + +#data +<style><!--</style>--> +#errors +#document +| <html> +| <head> +| <style> +| "<!--" +| <body> +| "-->" + +#data +<ul><li>A </li> <li>B</li></ul> +#errors +#document +| <html> +| <head> +| <body> +| <ul> +| <li> +| "A " +| " " +| <li> +| "B" + +#data +<table><form><input type=hidden><input></form><div></div></table> +#errors +#document +| <html> +| <head> +| <body> +| <input> +| <div> +| <table> +| <form> +| <input> +| type="hidden" + +#data +<i>A<b>B<p></i>C</b>D +#errors +#document +| <html> +| <head> +| <body> +| <i> +| "A" +| <b> +| "B" +| <b> +| <p> +| <b> +| <i> +| "C" +| "D" + +#data +<div></div> +#errors +#document +| <html> +| <head> +| <body> +| <div> + +#data +<svg></svg> +#errors +#document +| <html> +| <head> +| <body> +| <svg svg> + +#data +<math></math> +#errors +#document +| <html> +| <head> +| <body> +| <math math> diff --git a/libgo/go/html/testdata/webkit/inbody01.dat b/libgo/go/html/testdata/webkit/inbody01.dat new file mode 100644 index 00000000000..3f2bd374c03 --- /dev/null +++ b/libgo/go/html/testdata/webkit/inbody01.dat @@ -0,0 +1,43 @@ +#data +<button>1</foo> +#errors +#document +| <html> +| <head> +| <body> +| <button> +| "1" + +#data +<foo>1<p>2</foo> +#errors +#document +| <html> +| <head> +| <body> +| <foo> +| "1" +| <p> +| "2" + +#data +<dd>1</foo> +#errors +#document +| <html> +| <head> +| <body> +| <dd> +| "1" + +#data +<foo>1<dd>2</foo> +#errors +#document +| <html> +| <head> +| <body> +| <foo> +| "1" +| <dd> +| "2" diff --git a/libgo/go/html/testdata/webkit/isindex.dat b/libgo/go/html/testdata/webkit/isindex.dat new file mode 100644 index 00000000000..88325ffe64c --- /dev/null +++ b/libgo/go/html/testdata/webkit/isindex.dat @@ -0,0 +1,40 @@ +#data +<isindex> +#errors +#document +| <html> +| <head> +| <body> +| <form> +| <hr> +| <label> +| "This is a searchable index. Enter search keywords: " +| <input> +| name="isindex" +| <hr> + +#data +<isindex name="A" action="B" prompt="C" foo="D"> +#errors +#document +| <html> +| <head> +| <body> +| <form> +| action="B" +| <hr> +| <label> +| "C" +| <input> +| foo="D" +| name="isindex" +| <hr> + +#data +<form><isindex> +#errors +#document +| <html> +| <head> +| <body> +| <form> diff --git a/libgo/go/html/testdata/webkit/pending-spec-changes.dat b/libgo/go/html/testdata/webkit/pending-spec-changes.dat new file mode 100644 index 00000000000..e00ee85d3bf --- /dev/null +++ b/libgo/go/html/testdata/webkit/pending-spec-changes.dat @@ -0,0 +1,28 @@ +#data +<input type="hidden"><frameset> +#errors +21: Start tag seen without seeing a doctype first. Expected “<!DOCTYPE html>”. +31: “frameset” start tag seen. +31: End of file seen and there were open elements. +#document +| <html> +| <head> +| <frameset> + +#data +<!DOCTYPE html><table><caption><svg>foo</table>bar +#errors +47: End tag “table” did not match the name of the current open element (“svg”). +47: “table” closed but “caption” was still open. +47: End tag “table” seen, but there were open elements. +36: Unclosed element “svg”. +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <table> +| <caption> +| <svg svg> +| "foo" +| "bar" diff --git a/libgo/go/html/testdata/webkit/plain-text-unsafe.dat b/libgo/go/html/testdata/webkit/plain-text-unsafe.dat new file mode 100644 index 00000000000..2f40e83babc --- /dev/null +++ b/libgo/go/html/testdata/webkit/plain-text-unsafe.dat @@ -0,0 +1,8 @@ +#data +FOO
ZOO +#errors +#document +| <html> +| <head> +| <body> +| "FOO
ZOO" diff --git a/libgo/go/html/testdata/webkit/scripted/adoption01.dat b/libgo/go/html/testdata/webkit/scripted/adoption01.dat new file mode 100644 index 00000000000..4e08d0e84a0 --- /dev/null +++ b/libgo/go/html/testdata/webkit/scripted/adoption01.dat @@ -0,0 +1,15 @@ +#data +<p><b id="A"><script>document.getElementById("A").id = "B"</script></p>TEXT</b> +#errors +#document +| <html> +| <head> +| <body> +| <p> +| <b> +| id="B" +| <script> +| "document.getElementById("A").id = "B"" +| <b> +| id="A" +| "TEXT" diff --git a/libgo/go/html/testdata/webkit/scripted/webkit01.dat b/libgo/go/html/testdata/webkit/scripted/webkit01.dat new file mode 100644 index 00000000000..ef4a41ca00b --- /dev/null +++ b/libgo/go/html/testdata/webkit/scripted/webkit01.dat @@ -0,0 +1,28 @@ +#data +1<script>document.write("2")</script>3 +#errors +#document +| <html> +| <head> +| <body> +| "1" +| <script> +| "document.write("2")" +| "23" + +#data +1<script>document.write("<script>document.write('2')</scr"+ "ipt><script>document.write('3')</scr" + "ipt>")</script>4 +#errors +#document +| <html> +| <head> +| <body> +| "1" +| <script> +| "document.write("<script>document.write('2')</scr"+ "ipt><script>document.write('3')</scr" + "ipt>")" +| <script> +| "document.write('2')" +| "2" +| <script> +| "document.write('3')" +| "34" diff --git a/libgo/go/html/testdata/webkit/tables01.dat b/libgo/go/html/testdata/webkit/tables01.dat new file mode 100644 index 00000000000..88ef1fe2ee9 --- /dev/null +++ b/libgo/go/html/testdata/webkit/tables01.dat @@ -0,0 +1,197 @@ +#data +<table><th> +#errors +#document +| <html> +| <head> +| <body> +| <table> +| <tbody> +| <tr> +| <th> + +#data +<table><td> +#errors +#document +| <html> +| <head> +| <body> +| <table> +| <tbody> +| <tr> +| <td> + +#data +<table><col foo='bar'> +#errors +#document +| <html> +| <head> +| <body> +| <table> +| <colgroup> +| <col> +| foo="bar" + +#data +<table><colgroup></html>foo +#errors +#document +| <html> +| <head> +| <body> +| "foo" +| <table> +| <colgroup> + +#data +<table></table><p>foo +#errors +#document +| <html> +| <head> +| <body> +| <table> +| <p> +| "foo" + +#data +<table></body></caption></col></colgroup></html></tbody></td></tfoot></th></thead></tr><td> +#errors +#document +| <html> +| <head> +| <body> +| <table> +| <tbody> +| <tr> +| <td> + +#data +<table><select><option>3</select></table> +#errors +#document +| <html> +| <head> +| <body> +| <select> +| <option> +| "3" +| <table> + +#data +<table><select><table></table></select></table> +#errors +#document +| <html> +| <head> +| <body> +| <select> +| <table> +| <table> + +#data +<table><select></table> +#errors +#document +| <html> +| <head> +| <body> +| <select> +| <table> + +#data +<table><select><option>A<tr><td>B</td></tr></table> +#errors +#document +| <html> +| <head> +| <body> +| <select> +| <option> +| "A" +| <table> +| <tbody> +| <tr> +| <td> +| "B" + +#data +<table><td></body></caption></col></colgroup></html>foo +#errors +#document +| <html> +| <head> +| <body> +| <table> +| <tbody> +| <tr> +| <td> +| "foo" + +#data +<table><td>A</table>B +#errors +#document +| <html> +| <head> +| <body> +| <table> +| <tbody> +| <tr> +| <td> +| "A" +| "B" + +#data +<table><tr><caption> +#errors +#document +| <html> +| <head> +| <body> +| <table> +| <tbody> +| <tr> +| <caption> + +#data +<table><tr></body></caption></col></colgroup></html></td></th><td>foo +#errors +#document +| <html> +| <head> +| <body> +| <table> +| <tbody> +| <tr> +| <td> +| "foo" + +#data +<table><td><tr> +#errors +#document +| <html> +| <head> +| <body> +| <table> +| <tbody> +| <tr> +| <td> +| <tr> + +#data +<table><td><button><td> +#errors +#document +| <html> +| <head> +| <body> +| <table> +| <tbody> +| <tr> +| <td> +| <button> +| <td> diff --git a/libgo/go/html/testdata/webkit/tests17.dat b/libgo/go/html/testdata/webkit/tests17.dat new file mode 100644 index 00000000000..7b555f888de --- /dev/null +++ b/libgo/go/html/testdata/webkit/tests17.dat @@ -0,0 +1,153 @@ +#data +<!doctype html><table><tbody><select><tr> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <select> +| <table> +| <tbody> +| <tr> + +#data +<!doctype html><table><tr><select><td> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <select> +| <table> +| <tbody> +| <tr> +| <td> + +#data +<!doctype html><table><tr><td><select><td> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <table> +| <tbody> +| <tr> +| <td> +| <select> +| <td> + +#data +<!doctype html><table><tr><th><select><td> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <table> +| <tbody> +| <tr> +| <th> +| <select> +| <td> + +#data +<!doctype html><table><caption><select><tr> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <table> +| <caption> +| <select> +| <tbody> +| <tr> + +#data +<!doctype html><select><tr> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <select> + +#data +<!doctype html><select><td> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <select> + +#data +<!doctype html><select><th> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <select> + +#data +<!doctype html><select><tbody> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <select> + +#data +<!doctype html><select><thead> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <select> + +#data +<!doctype html><select><tfoot> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <select> + +#data +<!doctype html><select><caption> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <select> + +#data +<!doctype html><table><tr></table>a +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <table> +| <tbody> +| <tr> +| "a" diff --git a/libgo/go/html/testdata/webkit/tests18.dat b/libgo/go/html/testdata/webkit/tests18.dat new file mode 100644 index 00000000000..680e1f068a6 --- /dev/null +++ b/libgo/go/html/testdata/webkit/tests18.dat @@ -0,0 +1,269 @@ +#data +<!doctype html><plaintext></plaintext> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <plaintext> +| "</plaintext>" + +#data +<!doctype html><table><plaintext></plaintext> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <plaintext> +| "</plaintext>" +| <table> + +#data +<!doctype html><table><tbody><plaintext></plaintext> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <plaintext> +| "</plaintext>" +| <table> +| <tbody> + +#data +<!doctype html><table><tbody><tr><plaintext></plaintext> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <plaintext> +| "</plaintext>" +| <table> +| <tbody> +| <tr> + +#data +<!doctype html><table><tbody><tr><plaintext></plaintext> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <plaintext> +| "</plaintext>" +| <table> +| <tbody> +| <tr> + +#data +<!doctype html><table><td><plaintext></plaintext> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <table> +| <tbody> +| <tr> +| <td> +| <plaintext> +| "</plaintext>" + +#data +<!doctype html><table><caption><plaintext></plaintext> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <table> +| <caption> +| <plaintext> +| "</plaintext>" + +#data +<!doctype html><table><tr><style></script></style>abc +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| "abc" +| <table> +| <tbody> +| <tr> +| <style> +| "</script>" + +#data +<!doctype html><table><tr><script></style></script>abc +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| "abc" +| <table> +| <tbody> +| <tr> +| <script> +| "</style>" + +#data +<!doctype html><table><caption><style></script></style>abc +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <table> +| <caption> +| <style> +| "</script>" +| "abc" + +#data +<!doctype html><table><td><style></script></style>abc +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <table> +| <tbody> +| <tr> +| <td> +| <style> +| "</script>" +| "abc" + +#data +<!doctype html><select><script></style></script>abc +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <select> +| <script> +| "</style>" +| "abc" + +#data +<!doctype html><table><select><script></style></script>abc +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <select> +| <script> +| "</style>" +| "abc" +| <table> + +#data +<!doctype html><table><tr><select><script></style></script>abc +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <select> +| <script> +| "</style>" +| "abc" +| <table> +| <tbody> +| <tr> + +#data +<!doctype html><frameset></frameset><noframes>abc +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <frameset> +| <noframes> +| "abc" + +#data +<!doctype html><frameset></frameset><noframes>abc</noframes><!--abc--> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <frameset> +| <noframes> +| "abc" +| <!-- abc --> + +#data +<!doctype html><frameset></frameset></html><noframes>abc +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <frameset> +| <noframes> +| "abc" + +#data +<!doctype html><frameset></frameset></html><noframes>abc</noframes><!--abc--> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <frameset> +| <noframes> +| "abc" +| <!-- abc --> + +#data +<!doctype html><table><tr></tbody><tfoot> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <table> +| <tbody> +| <tr> +| <tfoot> + +#data +<!doctype html><table><td><svg></svg>abc<td> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <table> +| <tbody> +| <tr> +| <td> +| <svg svg> +| "abc" +| <td> diff --git a/libgo/go/html/testdata/webkit/tests19.dat b/libgo/go/html/testdata/webkit/tests19.dat new file mode 100644 index 00000000000..06222f5b9db --- /dev/null +++ b/libgo/go/html/testdata/webkit/tests19.dat @@ -0,0 +1,1220 @@ +#data +<!doctype html><math><mn DefinitionUrl="foo"> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <math math> +| <math mn> +| definitionURL="foo" + +#data +<!doctype html><html></p><!--foo--> +#errors +#document +| <!DOCTYPE html> +| <html> +| <!-- foo --> +| <head> +| <body> + +#data +<!doctype html><head></head></p><!--foo--> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <!-- foo --> +| <body> + +#data +<!doctype html><body><p><pre> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <pre> + +#data +<!doctype html><body><p><listing> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <listing> + +#data +<!doctype html><p><plaintext> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <plaintext> + +#data +<!doctype html><p><h1> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <h1> + +#data +<!doctype html><form><isindex> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <form> + +#data +<!doctype html><isindex action="POST"> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <form> +| action="POST" +| <hr> +| <label> +| "This is a searchable index. Enter search keywords: " +| <input> +| name="isindex" +| <hr> + +#data +<!doctype html><isindex prompt="this is isindex"> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <form> +| <hr> +| <label> +| "this is isindex" +| <input> +| name="isindex" +| <hr> + +#data +<!doctype html><isindex type="hidden"> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <form> +| <hr> +| <label> +| "This is a searchable index. Enter search keywords: " +| <input> +| name="isindex" +| type="hidden" +| <hr> + +#data +<!doctype html><isindex name="foo"> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <form> +| <hr> +| <label> +| "This is a searchable index. Enter search keywords: " +| <input> +| name="isindex" +| <hr> + +#data +<!doctype html><ruby><p><rp> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <ruby> +| <p> +| <rp> + +#data +<!doctype html><ruby><div><span><rp> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <ruby> +| <div> +| <span> +| <rp> + +#data +<!doctype html><ruby><div><p><rp> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <ruby> +| <div> +| <p> +| <rp> + +#data +<!doctype html><ruby><p><rt> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <ruby> +| <p> +| <rt> + +#data +<!doctype html><ruby><div><span><rt> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <ruby> +| <div> +| <span> +| <rt> + +#data +<!doctype html><ruby><div><p><rt> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <ruby> +| <div> +| <p> +| <rt> + +#data +<!doctype html><math/><foo> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <math math> +| <foo> + +#data +<!doctype html><svg/><foo> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <svg svg> +| <foo> + +#data +<!doctype html><div></body><!--foo--> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <div> +| <!-- foo --> + +#data +<!doctype html><h1><div><h3><span></h1>foo +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <h1> +| <div> +| <h3> +| <span> +| "foo" + +#data +<!doctype html><p></h3>foo +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| "foo" + +#data +<!doctype html><h3><li>abc</h2>foo +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <h3> +| <li> +| "abc" +| "foo" + +#data +<!doctype html><table>abc<!--foo--> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| "abc" +| <table> +| <!-- foo --> + +#data +<!doctype html><table> <!--foo--> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <table> +| " " +| <!-- foo --> + +#data +<!doctype html><table> b <!--foo--> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| " b " +| <table> +| <!-- foo --> + +#data +<!doctype html><select><option><option> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <select> +| <option> +| <option> + +#data +<!doctype html><select><option></optgroup> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <select> +| <option> + +#data +<!doctype html><select><option></optgroup> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <select> +| <option> + +#data +<!doctype html><p><math><mi><p><h1> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <math math> +| <math mi> +| <p> +| <h1> + +#data +<!doctype html><p><math><mo><p><h1> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <math math> +| <math mo> +| <p> +| <h1> + +#data +<!doctype html><p><math><mn><p><h1> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <math math> +| <math mn> +| <p> +| <h1> + +#data +<!doctype html><p><math><ms><p><h1> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <math math> +| <math ms> +| <p> +| <h1> + +#data +<!doctype html><p><math><mtext><p><h1> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <math math> +| <math mtext> +| <p> +| <h1> + +#data +<!doctype html><frameset></noframes> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <frameset> + +#data +<!doctype html><html c=d><body></html><html a=b> +#errors +#document +| <!DOCTYPE html> +| <html> +| a="b" +| c="d" +| <head> +| <body> + +#data +<!doctype html><html c=d><frameset></frameset></html><html a=b> +#errors +#document +| <!DOCTYPE html> +| <html> +| a="b" +| c="d" +| <head> +| <frameset> + +#data +<!doctype html><html><frameset></frameset></html><!--foo--> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <frameset> +| <!-- foo --> + +#data +<!doctype html><html><frameset></frameset></html> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <frameset> +| " " + +#data +<!doctype html><html><frameset></frameset></html>abc +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <frameset> + +#data +<!doctype html><html><frameset></frameset></html><p> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <frameset> + +#data +<!doctype html><html><frameset></frameset></html></p> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <frameset> + +#data +<html><frameset></frameset></html><!doctype html> +#errors +#document +| <html> +| <head> +| <frameset> + +#data +<!doctype html><body><frameset> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> + +#data +<!doctype html><p><frameset><frame> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <frameset> +| <frame> + +#data +<!doctype html><p>a<frameset> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| "a" + +#data +<!doctype html><p> <frameset><frame> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <frameset> +| <frame> + +#data +<!doctype html><pre><frameset> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <pre> + +#data +<!doctype html><listing><frameset> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <listing> + +#data +<!doctype html><li><frameset> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <li> + +#data +<!doctype html><dd><frameset> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <dd> + +#data +<!doctype html><dt><frameset> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <dt> + +#data +<!doctype html><button><frameset> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <button> + +#data +<!doctype html><applet><frameset> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <applet> + +#data +<!doctype html><marquee><frameset> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <marquee> + +#data +<!doctype html><object><frameset> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <object> + +#data +<!doctype html><table><frameset> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <table> + +#data +<!doctype html><area><frameset> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <area> + +#data +<!doctype html><basefont><frameset> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <basefont> +| <frameset> + +#data +<!doctype html><bgsound><frameset> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <bgsound> +| <frameset> + +#data +<!doctype html><br><frameset> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <br> + +#data +<!doctype html><embed><frameset> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <embed> + +#data +<!doctype html><img><frameset> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <img> + +#data +<!doctype html><input><frameset> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <input> + +#data +<!doctype html><keygen><frameset> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <keygen> + +#data +<!doctype html><wbr><frameset> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <wbr> + +#data +<!doctype html><hr><frameset> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <hr> + +#data +<!doctype html><textarea></textarea><frameset> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <textarea> + +#data +<!doctype html><xmp></xmp><frameset> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <xmp> + +#data +<!doctype html><iframe></iframe><frameset> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <iframe> + +#data +<!doctype html><select></select><frameset> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <select> + +#data +<!doctype html><svg></svg><frameset><frame> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <frameset> +| <frame> + +#data +<!doctype html><math></math><frameset><frame> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <frameset> +| <frame> + +#data +<!doctype html><svg><foreignObject><div> <frameset><frame> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <frameset> +| <frame> + +#data +<!doctype html><svg>a</svg><frameset><frame> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <svg svg> +| "a" + +#data +<!doctype html><svg> </svg><frameset><frame> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <frameset> +| <frame> + +#data +<html>aaa<frameset></frameset> +#errors +#document +| <html> +| <head> +| <body> +| "aaa" + +#data +<html> a <frameset></frameset> +#errors +#document +| <html> +| <head> +| <body> +| "a " + +#data +<!doctype html><div><frameset> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <frameset> + +#data +<!doctype html><div><body><frameset> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <div> + +#data +<!doctype html><p><math></p>a +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <math math> +| "a" + +#data +<!doctype html><p><math><mn><span></p>a +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <math math> +| <math mn> +| <span> +| <p> +| "a" + +#data +<!doctype html><math></html> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <math math> + +#data +<!doctype html><meta charset="ascii"> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <meta> +| charset="ascii" +| <body> + +#data +<!doctype html><meta http-equiv="content-type" content="text/html;charset=ascii"> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <meta> +| content="text/html;charset=ascii" +| http-equiv="content-type" +| <body> + +#data +<!doctype html><head><!--aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa--><meta charset="utf8"> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <!-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --> +| <meta> +| charset="utf8" +| <body> + +#data +<!doctype html><html a=b><head></head><html c=d> +#errors +#document +| <!DOCTYPE html> +| <html> +| a="b" +| c="d" +| <head> +| <body> + +#data +<!doctype html><image/> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <img> + +#data +<!doctype html>a<i>b<table>c<b>d</i>e</b>f +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| "a" +| <i> +| "bc" +| <b> +| "de" +| "f" +| <table> + +#data +<!doctype html><table><i>a<b>b<div>c<a>d</i>e</b>f +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <i> +| "a" +| <b> +| "b" +| <b> +| <div> +| <b> +| <i> +| "c" +| <a> +| "d" +| <a> +| "e" +| <a> +| "f" +| <table> + +#data +<!doctype html><i>a<b>b<div>c<a>d</i>e</b>f +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <i> +| "a" +| <b> +| "b" +| <b> +| <div> +| <b> +| <i> +| "c" +| <a> +| "d" +| <a> +| "e" +| <a> +| "f" + +#data +<!doctype html><table><i>a<b>b<div>c</i> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <i> +| "a" +| <b> +| "b" +| <b> +| <div> +| <i> +| "c" +| <table> + +#data +<!doctype html><table><i>a<b>b<div>c<a>d</i>e</b>f +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <i> +| "a" +| <b> +| "b" +| <b> +| <div> +| <b> +| <i> +| "c" +| <a> +| "d" +| <a> +| "e" +| <a> +| "f" +| <table> + +#data +<!doctype html><table><i>a<div>b<tr>c<b>d</i>e +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <i> +| "a" +| <div> +| "b" +| <i> +| "c" +| <b> +| "d" +| <b> +| "e" +| <table> +| <tbody> +| <tr> + +#data +<!doctype html><table><td><table><i>a<div>b<b>c</i>d +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <table> +| <tbody> +| <tr> +| <td> +| <i> +| "a" +| <div> +| <i> +| "b" +| <b> +| "c" +| <b> +| "d" +| <table> + +#data +<!doctype html><body><bgsound> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <bgsound> + +#data +<!doctype html><body><basefont> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <basefont> + +#data +<!doctype html><a><b></a><basefont> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <a> +| <b> +| <basefont> + +#data +<!doctype html><a><b></a><bgsound> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <a> +| <b> +| <bgsound> + +#data +<!doctype html><figcaption><article></figcaption>a +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <figcaption> +| <article> +| "a" + +#data +<!doctype html><summary><article></summary>a +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <summary> +| <article> +| "a" + +#data +<!doctype html><p><a><plaintext>b +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <a> +| <plaintext> +| <a> +| "b" diff --git a/libgo/go/html/testdata/webkit/tests20.dat b/libgo/go/html/testdata/webkit/tests20.dat new file mode 100644 index 00000000000..6bd825608f1 --- /dev/null +++ b/libgo/go/html/testdata/webkit/tests20.dat @@ -0,0 +1,455 @@ +#data +<!doctype html><p><button><button> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <button> +| <button> + +#data +<!doctype html><p><button><address> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <button> +| <address> + +#data +<!doctype html><p><button><blockquote> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <button> +| <blockquote> + +#data +<!doctype html><p><button><menu> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <button> +| <menu> + +#data +<!doctype html><p><button><p> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <button> +| <p> + +#data +<!doctype html><p><button><ul> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <button> +| <ul> + +#data +<!doctype html><p><button><h1> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <button> +| <h1> + +#data +<!doctype html><p><button><h6> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <button> +| <h6> + +#data +<!doctype html><p><button><listing> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <button> +| <listing> + +#data +<!doctype html><p><button><pre> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <button> +| <pre> + +#data +<!doctype html><p><button><form> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <button> +| <form> + +#data +<!doctype html><p><button><li> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <button> +| <li> + +#data +<!doctype html><p><button><dd> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <button> +| <dd> + +#data +<!doctype html><p><button><dt> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <button> +| <dt> + +#data +<!doctype html><p><button><plaintext> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <button> +| <plaintext> + +#data +<!doctype html><p><button><table> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <button> +| <table> + +#data +<!doctype html><p><button><hr> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <button> +| <hr> + +#data +<!doctype html><p><button><xmp> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <button> +| <xmp> + +#data +<!doctype html><p><button></p> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <button> +| <p> + +#data +<!doctype html><address><button></address>a +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <address> +| <button> +| "a" + +#data +<!doctype html><address><button></address>a +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <address> +| <button> +| "a" + +#data +<p><table></p> +#errors +#document +| <html> +| <head> +| <body> +| <p> +| <p> +| <table> + +#data +<!doctype html><svg> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <svg svg> + +#data +<!doctype html><p><figcaption> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <figcaption> + +#data +<!doctype html><p><summary> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <p> +| <summary> + +#data +<!doctype html><form><table><form> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <form> +| <table> + +#data +<!doctype html><table><form><form> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <table> +| <form> + +#data +<!doctype html><table><form></table><form> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <table> +| <form> + +#data +<!doctype html><svg><foreignObject><p> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <svg svg> +| <svg foreignObject> +| <p> + +#data +<!doctype html><svg><title>abc +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <svg svg> +| <svg title> +| "abc" + +#data +<option><span><option> +#errors +#document +| <html> +| <head> +| <body> +| <option> +| <span> +| <option> + +#data +<option><option> +#errors +#document +| <html> +| <head> +| <body> +| <option> +| <option> + +#data +<math><annotation-xml><div> +#errors +#document +| <html> +| <head> +| <body> +| <math math> +| <math annotation-xml> +| <div> + +#data +<math><annotation-xml encoding="application/svg+xml"><div> +#errors +#document +| <html> +| <head> +| <body> +| <math math> +| <math annotation-xml> +| encoding="application/svg+xml" +| <div> + +#data +<math><annotation-xml encoding="application/xhtml+xml"><div> +#errors +#document +| <html> +| <head> +| <body> +| <math math> +| <math annotation-xml> +| encoding="application/xhtml+xml" +| <div> + +#data +<math><annotation-xml encoding="aPPlication/xhtmL+xMl"><div> +#errors +#document +| <html> +| <head> +| <body> +| <math math> +| <math annotation-xml> +| encoding="aPPlication/xhtmL+xMl" +| <div> + +#data +<math><annotation-xml encoding="text/html"><div> +#errors +#document +| <html> +| <head> +| <body> +| <math math> +| <math annotation-xml> +| encoding="text/html" +| <div> + +#data +<math><annotation-xml encoding="Text/htmL"><div> +#errors +#document +| <html> +| <head> +| <body> +| <math math> +| <math annotation-xml> +| encoding="Text/htmL" +| <div> + +#data +<math><annotation-xml encoding=" text/html "><div> +#errors +#document +| <html> +| <head> +| <body> +| <math math> +| <math annotation-xml> +| encoding=" text/html " +| <div> diff --git a/libgo/go/html/testdata/webkit/tests21.dat b/libgo/go/html/testdata/webkit/tests21.dat new file mode 100644 index 00000000000..1260ec03e20 --- /dev/null +++ b/libgo/go/html/testdata/webkit/tests21.dat @@ -0,0 +1,221 @@ +#data +<svg><![CDATA[foo]]> +#errors +#document +| <html> +| <head> +| <body> +| <svg svg> +| "foo" + +#data +<math><![CDATA[foo]]> +#errors +#document +| <html> +| <head> +| <body> +| <math math> +| "foo" + +#data +<div><![CDATA[foo]]> +#errors +#document +| <html> +| <head> +| <body> +| <div> +| <!-- [CDATA[foo]] --> + +#data +<svg><![CDATA[foo +#errors +#document +| <html> +| <head> +| <body> +| <svg svg> +| "foo" + +#data +<svg><![CDATA[foo +#errors +#document +| <html> +| <head> +| <body> +| <svg svg> +| "foo" + +#data +<svg><![CDATA[ +#errors +#document +| <html> +| <head> +| <body> +| <svg svg> + +#data +<svg><![CDATA[]]> +#errors +#document +| <html> +| <head> +| <body> +| <svg svg> + +#data +<svg><![CDATA[]] >]]> +#errors +#document +| <html> +| <head> +| <body> +| <svg svg> +| "]] >" + +#data +<svg><![CDATA[]] >]]> +#errors +#document +| <html> +| <head> +| <body> +| <svg svg> +| "]] >" + +#data +<svg><![CDATA[]] +#errors +#document +| <html> +| <head> +| <body> +| <svg svg> +| "]]" + +#data +<svg><![CDATA[] +#errors +#document +| <html> +| <head> +| <body> +| <svg svg> +| "]" + +#data +<svg><![CDATA[]>a +#errors +#document +| <html> +| <head> +| <body> +| <svg svg> +| "]>a" + +#data +<svg><foreignObject><div><![CDATA[foo]]> +#errors +#document +| <html> +| <head> +| <body> +| <svg svg> +| <svg foreignObject> +| <div> +| <!-- [CDATA[foo]] --> + +#data +<svg><![CDATA[<svg>]]> +#errors +#document +| <html> +| <head> +| <body> +| <svg svg> +| "<svg>" + +#data +<svg><![CDATA[</svg>a]]> +#errors +#document +| <html> +| <head> +| <body> +| <svg svg> +| "</svg>a" + +#data +<svg><![CDATA[<svg>a +#errors +#document +| <html> +| <head> +| <body> +| <svg svg> +| "<svg>a" + +#data +<svg><![CDATA[</svg>a +#errors +#document +| <html> +| <head> +| <body> +| <svg svg> +| "</svg>a" + +#data +<svg><![CDATA[<svg>]]><path> +#errors +#document +| <html> +| <head> +| <body> +| <svg svg> +| "<svg>" +| <svg path> + +#data +<svg><![CDATA[<svg>]]></path> +#errors +#document +| <html> +| <head> +| <body> +| <svg svg> +| "<svg>" + +#data +<svg><![CDATA[<svg>]]><!--path--> +#errors +#document +| <html> +| <head> +| <body> +| <svg svg> +| "<svg>" +| <!-- path --> + +#data +<svg><![CDATA[<svg>]]>path +#errors +#document +| <html> +| <head> +| <body> +| <svg svg> +| "<svg>path" + +#data +<svg><![CDATA[<!--svg-->]]> +#errors +#document +| <html> +| <head> +| <body> +| <svg svg> +| "<!--svg-->" diff --git a/libgo/go/html/testdata/webkit/tests22.dat b/libgo/go/html/testdata/webkit/tests22.dat new file mode 100644 index 00000000000..aab27b2e904 --- /dev/null +++ b/libgo/go/html/testdata/webkit/tests22.dat @@ -0,0 +1,157 @@ +#data +<a><b><big><em><strong><div>X</a> +#errors +#document +| <html> +| <head> +| <body> +| <a> +| <b> +| <big> +| <em> +| <strong> +| <big> +| <em> +| <strong> +| <div> +| <a> +| "X" + +#data +<a><b><div id=1><div id=2><div id=3><div id=4><div id=5><div id=6><div id=7><div id=8>A</a> +#errors +#document +| <html> +| <head> +| <body> +| <a> +| <b> +| <b> +| <div> +| id="1" +| <a> +| <div> +| id="2" +| <a> +| <div> +| id="3" +| <a> +| <div> +| id="4" +| <a> +| <div> +| id="5" +| <a> +| <div> +| id="6" +| <a> +| <div> +| id="7" +| <a> +| <div> +| id="8" +| <a> +| "A" + +#data +<a><b><div id=1><div id=2><div id=3><div id=4><div id=5><div id=6><div id=7><div id=8><div id=9>A</a> +#errors +#document +| <html> +| <head> +| <body> +| <a> +| <b> +| <b> +| <div> +| id="1" +| <a> +| <div> +| id="2" +| <a> +| <div> +| id="3" +| <a> +| <div> +| id="4" +| <a> +| <div> +| id="5" +| <a> +| <div> +| id="6" +| <a> +| <div> +| id="7" +| <a> +| <div> +| id="8" +| <a> +| <div> +| id="9" +| "A" + +#data +<a><b><div id=1><div id=2><div id=3><div id=4><div id=5><div id=6><div id=7><div id=8><div id=9><div id=10>A</a> +#errors +#document +| <html> +| <head> +| <body> +| <a> +| <b> +| <b> +| <div> +| id="1" +| <a> +| <div> +| id="2" +| <a> +| <div> +| id="3" +| <a> +| <div> +| id="4" +| <a> +| <div> +| id="5" +| <a> +| <div> +| id="6" +| <a> +| <div> +| id="7" +| <a> +| <div> +| id="8" +| <a> +| <div> +| id="9" +| <div> +| id="10" +| "A" + +#data +<cite><b><cite><i><cite><i><cite><i><div>X</b>TEST +#errors +Line: 1 Col: 6 Unexpected start tag (cite). Expected DOCTYPE. +Line: 1 Col: 46 End tag (b) violates step 1, paragraph 3 of the adoption agency algorithm. +Line: 1 Col: 50 Expected closing tag. Unexpected end of file. +#document +| <html> +| <head> +| <body> +| <cite> +| <b> +| <cite> +| <i> +| <cite> +| <i> +| <cite> +| <i> +| <i> +| <i> +| <div> +| <b> +| "X" +| "TEST" diff --git a/libgo/go/html/testdata/webkit/tests23.dat b/libgo/go/html/testdata/webkit/tests23.dat new file mode 100644 index 00000000000..34d2a73f1c7 --- /dev/null +++ b/libgo/go/html/testdata/webkit/tests23.dat @@ -0,0 +1,155 @@ +#data +<p><font size=4><font color=red><font size=4><font size=4><font size=4><font size=4><font size=4><font color=red><p>X +#errors +3: Start tag seen without seeing a doctype first. Expected “<!DOCTYPE html>”. +116: Unclosed elements. +117: End of file seen and there were open elements. +#document +| <html> +| <head> +| <body> +| <p> +| <font> +| size="4" +| <font> +| color="red" +| <font> +| size="4" +| <font> +| size="4" +| <font> +| size="4" +| <font> +| size="4" +| <font> +| size="4" +| <font> +| color="red" +| <p> +| <font> +| color="red" +| <font> +| size="4" +| <font> +| size="4" +| <font> +| size="4" +| <font> +| color="red" +| "X" + +#data +<p><font size=4><font size=4><font size=4><font size=4><p>X +#errors +#document +| <html> +| <head> +| <body> +| <p> +| <font> +| size="4" +| <font> +| size="4" +| <font> +| size="4" +| <font> +| size="4" +| <p> +| <font> +| size="4" +| <font> +| size="4" +| <font> +| size="4" +| "X" + +#data +<p><font size=4><font size=4><font size=4><font size="5"><font size=4><p>X +#errors +#document +| <html> +| <head> +| <body> +| <p> +| <font> +| size="4" +| <font> +| size="4" +| <font> +| size="4" +| <font> +| size="5" +| <font> +| size="4" +| <p> +| <font> +| size="4" +| <font> +| size="4" +| <font> +| size="5" +| <font> +| size="4" +| "X" + +#data +<p><font size=4 id=a><font size=4 id=b><font size=4><font size=4><p>X +#errors +#document +| <html> +| <head> +| <body> +| <p> +| <font> +| id="a" +| size="4" +| <font> +| id="b" +| size="4" +| <font> +| size="4" +| <font> +| size="4" +| <p> +| <font> +| id="a" +| size="4" +| <font> +| id="b" +| size="4" +| <font> +| size="4" +| <font> +| size="4" +| "X" + +#data +<p><b id=a><b id=a><b id=a><b><object><b id=a><b id=a>X</object><p>Y +#errors +#document +| <html> +| <head> +| <body> +| <p> +| <b> +| id="a" +| <b> +| id="a" +| <b> +| id="a" +| <b> +| <object> +| <b> +| id="a" +| <b> +| id="a" +| "X" +| <p> +| <b> +| id="a" +| <b> +| id="a" +| <b> +| id="a" +| <b> +| "Y" diff --git a/libgo/go/html/testdata/webkit/tests24.dat b/libgo/go/html/testdata/webkit/tests24.dat new file mode 100644 index 00000000000..f6dc7eb48a5 --- /dev/null +++ b/libgo/go/html/testdata/webkit/tests24.dat @@ -0,0 +1,79 @@ +#data +<!DOCTYPE html>≂̸ +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| "≂̸" + +#data +<!DOCTYPE html>≂̸A +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| "≂̸A" + +#data +<!DOCTYPE html>   +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| " " + +#data +<!DOCTYPE html>  A +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| " A" + +#data +<!DOCTYPE html>⊂⃒ +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| "⊂⃒" + +#data +<!DOCTYPE html>⊂⃒A +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| "⊂⃒A" + +#data +<!DOCTYPE html>𝔾 +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| "𝔾" + +#data +<!DOCTYPE html>𝔾A +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| "𝔾A" diff --git a/libgo/go/html/testdata/webkit/tests25.dat b/libgo/go/html/testdata/webkit/tests25.dat new file mode 100644 index 00000000000..00de7295b71 --- /dev/null +++ b/libgo/go/html/testdata/webkit/tests25.dat @@ -0,0 +1,219 @@ +#data +<!DOCTYPE html><body><foo>A +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <foo> +| "A" + +#data +<!DOCTYPE html><body><area>A +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <area> +| "A" + +#data +<!DOCTYPE html><body><base>A +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <base> +| "A" + +#data +<!DOCTYPE html><body><basefont>A +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <basefont> +| "A" + +#data +<!DOCTYPE html><body><bgsound>A +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <bgsound> +| "A" + +#data +<!DOCTYPE html><body><br>A +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <br> +| "A" + +#data +<!DOCTYPE html><body><col>A +#errors +26: Stray start tag “col”. +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| "A" + +#data +<!DOCTYPE html><body><command>A +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <command> +| "A" + +#data +<!DOCTYPE html><body><embed>A +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <embed> +| "A" + +#data +<!DOCTYPE html><body><frame>A +#errors +26: Stray start tag “frame”. +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| "A" + +#data +<!DOCTYPE html><body><hr>A +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <hr> +| "A" + +#data +<!DOCTYPE html><body><img>A +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <img> +| "A" + +#data +<!DOCTYPE html><body><input>A +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <input> +| "A" + +#data +<!DOCTYPE html><body><keygen>A +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <keygen> +| "A" + +#data +<!DOCTYPE html><body><link>A +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <link> +| "A" + +#data +<!DOCTYPE html><body><meta>A +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <meta> +| "A" + +#data +<!DOCTYPE html><body><param>A +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <param> +| "A" + +#data +<!DOCTYPE html><body><source>A +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <source> +| "A" + +#data +<!DOCTYPE html><body><track>A +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <track> +| "A" + +#data +<!DOCTYPE html><body><wbr>A +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <wbr> +| "A" diff --git a/libgo/go/html/testdata/webkit/tests26.dat b/libgo/go/html/testdata/webkit/tests26.dat new file mode 100644 index 00000000000..da128e7794b --- /dev/null +++ b/libgo/go/html/testdata/webkit/tests26.dat @@ -0,0 +1,195 @@ +#data +<!DOCTYPE html><body><a href='#1'><nobr>1<nobr></a><br><a href='#2'><nobr>2<nobr></a><br><a href='#3'><nobr>3<nobr></a> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <a> +| href="#1" +| <nobr> +| "1" +| <nobr> +| <nobr> +| <br> +| <a> +| href="#2" +| <a> +| href="#2" +| <nobr> +| "2" +| <nobr> +| <nobr> +| <br> +| <a> +| href="#3" +| <a> +| href="#3" +| <nobr> +| "3" +| <nobr> + +#data +<!DOCTYPE html><body><b><nobr>1<nobr></b><i><nobr>2<nobr></i>3 +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <b> +| <nobr> +| "1" +| <nobr> +| <nobr> +| <i> +| <i> +| <nobr> +| "2" +| <nobr> +| <nobr> +| "3" + +#data +<!DOCTYPE html><body><b><nobr>1<table><nobr></b><i><nobr>2<nobr></i>3 +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <b> +| <nobr> +| "1" +| <nobr> +| <i> +| <i> +| <nobr> +| "2" +| <nobr> +| <nobr> +| "3" +| <table> + +#data +<!DOCTYPE html><body><b><nobr>1<table><tr><td><nobr></b><i><nobr>2<nobr></i>3 +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <b> +| <nobr> +| "1" +| <table> +| <tbody> +| <tr> +| <td> +| <nobr> +| <i> +| <i> +| <nobr> +| "2" +| <nobr> +| <nobr> +| "3" + +#data +<!DOCTYPE html><body><b><nobr>1<div><nobr></b><i><nobr>2<nobr></i>3 +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <b> +| <nobr> +| "1" +| <div> +| <b> +| <nobr> +| <nobr> +| <nobr> +| <i> +| <i> +| <nobr> +| "2" +| <nobr> +| <nobr> +| "3" + +#data +<!DOCTYPE html><body><b><nobr>1<nobr></b><div><i><nobr>2<nobr></i>3 +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <b> +| <nobr> +| "1" +| <nobr> +| <div> +| <nobr> +| <i> +| <i> +| <nobr> +| "2" +| <nobr> +| <nobr> +| "3" + +#data +<!DOCTYPE html><body><b><nobr>1<nobr><ins></b><i><nobr> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <b> +| <nobr> +| "1" +| <nobr> +| <ins> +| <nobr> +| <i> +| <i> +| <nobr> + +#data +<!DOCTYPE html><body><b><nobr>1<ins><nobr></b><i>2 +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <b> +| <nobr> +| "1" +| <ins> +| <nobr> +| <nobr> +| <i> +| "2" + +#data +<!DOCTYPE html><body><b>1<nobr></b><i><nobr>2</i> +#errors +#document +| <!DOCTYPE html> +| <html> +| <head> +| <body> +| <b> +| "1" +| <nobr> +| <nobr> +| <i> +| <i> +| <nobr> +| "2" diff --git a/libgo/go/html/testdata/webkit/tests_innerHTML_1.dat b/libgo/go/html/testdata/webkit/tests_innerHTML_1.dat new file mode 100644 index 00000000000..052fac7d554 --- /dev/null +++ b/libgo/go/html/testdata/webkit/tests_innerHTML_1.dat @@ -0,0 +1,733 @@ +#data +<body><span> +#errors +#document-fragment +body +#document +| <span> + +#data +<span><body> +#errors +#document-fragment +body +#document +| <span> + +#data +<span><body> +#errors +#document-fragment +div +#document +| <span> + +#data +<body><span> +#errors +#document-fragment +html +#document +| <head> +| <body> +| <span> + +#data +<frameset><span> +#errors +#document-fragment +body +#document +| <span> + +#data +<span><frameset> +#errors +#document-fragment +body +#document +| <span> + +#data +<span><frameset> +#errors +#document-fragment +div +#document +| <span> + +#data +<frameset><span> +#errors +#document-fragment +html +#document +| <head> +| <frameset> + +#data +<table><tr> +#errors +#document-fragment +table +#document +| <tbody> +| <tr> + +#data +</table><tr> +#errors +#document-fragment +table +#document +| <tbody> +| <tr> + +#data +<a> +#errors +#document-fragment +table +#document +| <a> + +#data +<a> +#errors +#document-fragment +table +#document +| <a> + +#data +<a><caption>a +#errors +#document-fragment +table +#document +| <a> +| <caption> +| "a" + +#data +<a><colgroup><col> +#errors +#document-fragment +table +#document +| <a> +| <colgroup> +| <col> + +#data +<a><tbody><tr> +#errors +#document-fragment +table +#document +| <a> +| <tbody> +| <tr> + +#data +<a><tfoot><tr> +#errors +#document-fragment +table +#document +| <a> +| <tfoot> +| <tr> + +#data +<a><thead><tr> +#errors +#document-fragment +table +#document +| <a> +| <thead> +| <tr> + +#data +<a><tr> +#errors +#document-fragment +table +#document +| <a> +| <tbody> +| <tr> + +#data +<a><th> +#errors +#document-fragment +table +#document +| <a> +| <tbody> +| <tr> +| <th> + +#data +<a><td> +#errors +#document-fragment +table +#document +| <a> +| <tbody> +| <tr> +| <td> + +#data +<table></table><tbody> +#errors +#document-fragment +caption +#document +| <table> + +#data +</table><span> +#errors +#document-fragment +caption +#document +| <span> + +#data +<span></table> +#errors +#document-fragment +caption +#document +| <span> + +#data +</caption><span> +#errors +#document-fragment +caption +#document +| <span> + +#data +<span></caption><span> +#errors +#document-fragment +caption +#document +| <span> +| <span> + +#data +<span><caption><span> +#errors +#document-fragment +caption +#document +| <span> +| <span> + +#data +<span><col><span> +#errors +#document-fragment +caption +#document +| <span> +| <span> + +#data +<span><colgroup><span> +#errors +#document-fragment +caption +#document +| <span> +| <span> + +#data +<span><html><span> +#errors +#document-fragment +caption +#document +| <span> +| <span> + +#data +<span><tbody><span> +#errors +#document-fragment +caption +#document +| <span> +| <span> + +#data +<span><td><span> +#errors +#document-fragment +caption +#document +| <span> +| <span> + +#data +<span><tfoot><span> +#errors +#document-fragment +caption +#document +| <span> +| <span> + +#data +<span><thead><span> +#errors +#document-fragment +caption +#document +| <span> +| <span> + +#data +<span><th><span> +#errors +#document-fragment +caption +#document +| <span> +| <span> + +#data +<span><tr><span> +#errors +#document-fragment +caption +#document +| <span> +| <span> + +#data +<span></table><span> +#errors +#document-fragment +caption +#document +| <span> +| <span> + +#data +</colgroup><col> +#errors +#document-fragment +colgroup +#document +| <col> + +#data +<a><col> +#errors +#document-fragment +colgroup +#document +| <col> + +#data +<caption><a> +#errors +#document-fragment +tbody +#document +| <a> + +#data +<col><a> +#errors +#document-fragment +tbody +#document +| <a> + +#data +<colgroup><a> +#errors +#document-fragment +tbody +#document +| <a> + +#data +<tbody><a> +#errors +#document-fragment +tbody +#document +| <a> + +#data +<tfoot><a> +#errors +#document-fragment +tbody +#document +| <a> + +#data +<thead><a> +#errors +#document-fragment +tbody +#document +| <a> + +#data +</table><a> +#errors +#document-fragment +tbody +#document +| <a> + +#data +<a><tr> +#errors +#document-fragment +tbody +#document +| <a> +| <tr> + +#data +<a><td> +#errors +#document-fragment +tbody +#document +| <a> +| <tr> +| <td> + +#data +<a><td> +#errors +#document-fragment +tbody +#document +| <a> +| <tr> +| <td> + +#data +<a><td> +#errors +#document-fragment +tbody +#document +| <a> +| <tr> +| <td> + +#data +<td><table><tbody><a><tr> +#errors +#document-fragment +tbody +#document +| <tr> +| <td> +| <a> +| <table> +| <tbody> +| <tr> + +#data +</tr><td> +#errors +#document-fragment +tr +#document +| <td> + +#data +<td><table><a><tr></tr><tr> +#errors +#document-fragment +tr +#document +| <td> +| <a> +| <table> +| <tbody> +| <tr> +| <tr> + +#data +<caption><td> +#errors +#document-fragment +tr +#document +| <td> + +#data +<col><td> +#errors +#document-fragment +tr +#document +| <td> + +#data +<colgroup><td> +#errors +#document-fragment +tr +#document +| <td> + +#data +<tbody><td> +#errors +#document-fragment +tr +#document +| <td> + +#data +<tfoot><td> +#errors +#document-fragment +tr +#document +| <td> + +#data +<thead><td> +#errors +#document-fragment +tr +#document +| <td> + +#data +<tr><td> +#errors +#document-fragment +tr +#document +| <td> + +#data +</table><td> +#errors +#document-fragment +tr +#document +| <td> + +#data +<td><table></table><td> +#errors +#document-fragment +tr +#document +| <td> +| <table> +| <td> + +#data +<td><table></table><td> +#errors +#document-fragment +tr +#document +| <td> +| <table> +| <td> + +#data +<caption><a> +#errors +#document-fragment +td +#document +| <a> + +#data +<col><a> +#errors +#document-fragment +td +#document +| <a> + +#data +<colgroup><a> +#errors +#document-fragment +td +#document +| <a> + +#data +<tbody><a> +#errors +#document-fragment +td +#document +| <a> + +#data +<tfoot><a> +#errors +#document-fragment +td +#document +| <a> + +#data +<th><a> +#errors +#document-fragment +td +#document +| <a> + +#data +<thead><a> +#errors +#document-fragment +td +#document +| <a> + +#data +<tr><a> +#errors +#document-fragment +td +#document +| <a> + +#data +</table><a> +#errors +#document-fragment +td +#document +| <a> + +#data +</tbody><a> +#errors +#document-fragment +td +#document +| <a> + +#data +</td><a> +#errors +#document-fragment +td +#document +| <a> + +#data +</tfoot><a> +#errors +#document-fragment +td +#document +| <a> + +#data +</thead><a> +#errors +#document-fragment +td +#document +| <a> + +#data +</th><a> +#errors +#document-fragment +td +#document +| <a> + +#data +</tr><a> +#errors +#document-fragment +td +#document +| <a> + +#data +<table><td><td> +#errors +#document-fragment +td +#document +| <table> +| <tbody> +| <tr> +| <td> +| <td> + +#data +</select><option> +#errors +#document-fragment +select +#document +| <option> + +#data +<input><option> +#errors +#document-fragment +select +#document +| <option> + +#data +<keygen><option> +#errors +#document-fragment +select +#document +| <option> + +#data +<textarea><option> +#errors +#document-fragment +select +#document +| <option> + +#data +</html><!--abc--> +#errors +#document-fragment +html +#document +| <head> +| <body> +| <!-- abc --> + +#data +</frameset><frame> +#errors +#document-fragment +frameset +#document +| <frame> diff --git a/libgo/go/html/testdata/webkit/tricky01.dat b/libgo/go/html/testdata/webkit/tricky01.dat new file mode 100644 index 00000000000..08419924486 --- /dev/null +++ b/libgo/go/html/testdata/webkit/tricky01.dat @@ -0,0 +1,261 @@ +#data +<b><p>Bold </b> Not bold</p> +Also not bold. +#errors +#document +| <html> +| <head> +| <body> +| <b> +| <p> +| <b> +| "Bold " +| " Not bold" +| " +Also not bold." + +#data +<html> +<font color=red><i>Italic and Red<p>Italic and Red </font> Just italic.</p> Italic only.</i> Plain +<p>I should not be red. <font color=red>Red. <i>Italic and red.</p> +<p>Italic and red. </i> Red.</font> I should not be red.</p> +<b>Bold <i>Bold and italic</b> Only Italic </i> Plain +#errors +#document +| <html> +| <head> +| <body> +| <font> +| color="red" +| <i> +| "Italic and Red" +| <i> +| <p> +| <font> +| color="red" +| "Italic and Red " +| " Just italic." +| " Italic only." +| " Plain +" +| <p> +| "I should not be red. " +| <font> +| color="red" +| "Red. " +| <i> +| "Italic and red." +| <font> +| color="red" +| <i> +| " +" +| <p> +| <font> +| color="red" +| <i> +| "Italic and red. " +| " Red." +| " I should not be red." +| " +" +| <b> +| "Bold " +| <i> +| "Bold and italic" +| <i> +| " Only Italic " +| " Plain" + +#data +<html><body> +<p><font size="7">First paragraph.</p> +<p>Second paragraph.</p></font> +<b><p><i>Bold and Italic</b> Italic</p> +#errors +#document +| <html> +| <head> +| <body> +| " +" +| <p> +| <font> +| size="7" +| "First paragraph." +| <font> +| size="7" +| " +" +| <p> +| "Second paragraph." +| " +" +| <b> +| <p> +| <b> +| <i> +| "Bold and Italic" +| <i> +| " Italic" + +#data +<html> +<dl> +<dt><b>Boo +<dd>Goo? +</dl> +</html> +#errors +#document +| <html> +| <head> +| <body> +| <dl> +| " +" +| <dt> +| <b> +| "Boo +" +| <dd> +| <b> +| "Goo? +" +| <b> +| " +" + +#data +<html><body> +<label><a><div>Hello<div>World</div></a></label> +</body></html> +#errors +#document +| <html> +| <head> +| <body> +| " +" +| <label> +| <a> +| <div> +| <a> +| "Hello" +| <div> +| "World" +| " +" + +#data +<table><center> <font>a</center> <img> <tr><td> </td> </tr> </table> +#errors +#document +| <html> +| <head> +| <body> +| <center> +| " " +| <font> +| "a" +| <font> +| <img> +| " " +| <table> +| " " +| <tbody> +| <tr> +| <td> +| " " +| " " +| " " + +#data +<table><tr><p><a><p>You should see this text. +#errors +#document +| <html> +| <head> +| <body> +| <p> +| <a> +| <p> +| <a> +| "You should see this text." +| <table> +| <tbody> +| <tr> + +#data +<TABLE> +<TR> +<CENTER><CENTER><TD></TD></TR><TR> +<FONT> +<TABLE><tr></tr></TABLE> +</P> +<a></font><font></a> +This page contains an insanely badly-nested tag sequence. +#errors +#document +| <html> +| <head> +| <body> +| <center> +| <center> +| <font> +| " +" +| <table> +| " +" +| <tbody> +| <tr> +| " +" +| <td> +| <tr> +| " +" +| <table> +| <tbody> +| <tr> +| <font> +| " +" +| <p> +| " +" +| <a> +| <a> +| <font> +| <font> +| " +This page contains an insanely badly-nested tag sequence." + +#data +<html> +<body> +<b><nobr><div>This text is in a div inside a nobr</nobr>More text that should not be in the nobr, i.e., the +nobr should have closed the div inside it implicitly. </b><pre>A pre tag outside everything else.</pre> +</body> +</html> +#errors +#document +| <html> +| <head> +| <body> +| " +" +| <b> +| <nobr> +| <div> +| <b> +| <nobr> +| "This text is in a div inside a nobr" +| "More text that should not be in the nobr, i.e., the +nobr should have closed the div inside it implicitly. " +| <pre> +| "A pre tag outside everything else." +| " + +" diff --git a/libgo/go/html/testdata/webkit/webkit02.dat b/libgo/go/html/testdata/webkit/webkit02.dat new file mode 100644 index 00000000000..2218f4298c5 --- /dev/null +++ b/libgo/go/html/testdata/webkit/webkit02.dat @@ -0,0 +1,104 @@ +#data +<foo bar=qux/> +#errors +#document +| <html> +| <head> +| <body> +| <foo> +| bar="qux/" + +#data +<p id="status"><noscript><strong>A</strong></noscript><span>B</span></p> +#errors +#document +| <html> +| <head> +| <body> +| <p> +| id="status" +| <noscript> +| "<strong>A</strong>" +| <span> +| "B" + +#data +<div><sarcasm><div></div></sarcasm></div> +#errors +#document +| <html> +| <head> +| <body> +| <div> +| <sarcasm> +| <div> + +#data +<html><body><img src="" border="0" alt="><div>A</div></body></html> +#errors +#document +| <html> +| <head> +| <body> + +#data +<table><td></tbody>A +#errors +#document +| <html> +| <head> +| <body> +| "A" +| <table> +| <tbody> +| <tr> +| <td> + +#data +<table><td></thead>A +#errors +#document +| <html> +| <head> +| <body> +| <table> +| <tbody> +| <tr> +| <td> +| "A" + +#data +<table><td></tfoot>A +#errors +#document +| <html> +| <head> +| <body> +| <table> +| <tbody> +| <tr> +| <td> +| "A" + +#data +<table><thead><td></tbody>A +#errors +#document +| <html> +| <head> +| <body> +| <table> +| <thead> +| <tr> +| <td> +| "A" + +#data +<legend>test</legend> +#errors +#document +| <html> +| <head> +| <body> +| <legend> +| "test" diff --git a/libgo/go/http/cgi/host_test.go b/libgo/go/http/cgi/host_test.go index 1dc3abdbb32..ff46631383b 100644 --- a/libgo/go/http/cgi/host_test.go +++ b/libgo/go/http/cgi/host_test.go @@ -374,6 +374,8 @@ func TestCopyError(t *testing.T) { } } +/* This test doesn't work in gccgo's testing environment. + func TestDirUnix(t *testing.T) { if skipTest(t) || runtime.GOOS == "windows" { return @@ -402,6 +404,8 @@ func TestDirUnix(t *testing.T) { runCgiTest(t, h, "GET /test.cgi HTTP/1.0\nHost: example.com\n\n", expectedMap) } +*/ + func TestDirWindows(t *testing.T) { if skipTest(t) || runtime.GOOS != "windows" { return diff --git a/libgo/go/http/cgi/testdata/test.cgi b/libgo/go/http/cgi/testdata/test.cgi new file mode 100755 index 00000000000..b46b1330f38 --- /dev/null +++ b/libgo/go/http/cgi/testdata/test.cgi @@ -0,0 +1,96 @@ +#!/usr/bin/perl +# Copyright 2011 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. +# +# Test script run as a child process under cgi_test.go + +use strict; +use Cwd; + +my $q = MiniCGI->new; +my $params = $q->Vars; + +if ($params->{"loc"}) { + print "Location: $params->{loc}\r\n\r\n"; + exit(0); +} + +my $NL = "\r\n"; +$NL = "\n" if $params->{mode} eq "NL"; + +my $p = sub { + print "$_[0]$NL"; +}; + +# With carriage returns +$p->("Content-Type: text/html"); +$p->("X-CGI-Pid: $$"); +$p->("X-Test-Header: X-Test-Value"); +$p->(""); + +if ($params->{"bigresponse"}) { + for (1..1024) { + print "A" x 1024, "\n"; + } + exit 0; +} + +print "test=Hello CGI\n"; + +foreach my $k (sort keys %$params) { + print "param-$k=$params->{$k}\n"; +} + +foreach my $k (sort keys %ENV) { + my $clean_env = $ENV{$k}; + $clean_env =~ s/[\n\r]//g; + print "env-$k=$clean_env\n"; +} + +# NOTE: don't call getcwd() for windows. +# msys return /c/go/src/... not C:\go\... +my $dir; +if ($^O eq 'MSWin32' || $^O eq 'msys') { + my $cmd = $ENV{'COMSPEC'} || 'c:\\windows\\system32\\cmd.exe'; + $cmd =~ s!\\!/!g; + $dir = `$cmd /c cd`; + chomp $dir; +} else { + $dir = getcwd(); +} +print "cwd=$dir\n"; + + +# A minimal version of CGI.pm, for people without the perl-modules +# package installed. (CGI.pm used to be part of the Perl core, but +# some distros now bundle perl-base and perl-modules separately...) +package MiniCGI; + +sub new { + my $class = shift; + return bless {}, $class; +} + +sub Vars { + my $self = shift; + my $pairs; + if ($ENV{CONTENT_LENGTH}) { + $pairs = do { local $/; <STDIN> }; + } else { + $pairs = $ENV{QUERY_STRING}; + } + my $vars = {}; + foreach my $kv (split(/&/, $pairs)) { + my ($k, $v) = split(/=/, $kv, 2); + $vars->{_urldecode($k)} = _urldecode($v); + } + return $vars; +} + +sub _urldecode { + my $v = shift; + $v =~ tr/+/ /; + $v =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; + return $v; +} diff --git a/libgo/go/image/png/testdata/pngsuite/basn3p08-trns.png b/libgo/go/image/png/testdata/pngsuite/basn3p08-trns.png Binary files differnew file mode 100644 index 00000000000..b0fc0c1be74 --- /dev/null +++ b/libgo/go/image/png/testdata/pngsuite/basn3p08-trns.png diff --git a/libgo/go/image/png/testdata/pngsuite/basn3p08-trns.sng b/libgo/go/image/png/testdata/pngsuite/basn3p08-trns.sng new file mode 100644 index 00000000000..78dc367bba3 --- /dev/null +++ b/libgo/go/image/png/testdata/pngsuite/basn3p08-trns.sng @@ -0,0 +1,301 @@ +#SNG: from basn3p08-trns.png +IHDR { + width: 32; height: 32; bitdepth: 8; + using color palette; +} +gAMA {1.0000} +PLTE { + (255, 3, 7) # rgb = (0xff,0x03,0x07) + (255, 4, 7) # rgb = (0xff,0x04,0x07) + (255, 9, 7) # rgb = (0xff,0x09,0x07) + (217, 14, 7) # rgb = (0xd9,0x0e,0x07) + (255, 14, 7) # rgb = (0xff,0x0e,0x07) + ( 2, 22, 19) # rgb = (0x02,0x16,0x13) + (255, 26, 7) # rgb = (0xff,0x1a,0x07) + (255, 31, 7) # rgb = (0xff,0x1f,0x07) + ( 10, 37, 14) # rgb = (0x0a,0x25,0x0e) + (179, 37, 6) # rgb = (0xb3,0x25,0x06) + (254, 42, 7) # rgb = (0xfe,0x2a,0x07) + (255, 45, 7) # rgb = (0xff,0x2d,0x07) + ( 25, 46, 9) # rgb = (0x19,0x2e,0x09) + ( 0, 48,254) # rgb = (0x00,0x30,0xfe) + ( 0, 48,255) # rgb = (0x00,0x30,0xff) + ( 0, 49,255) # rgb = (0x00,0x31,0xff) + ( 0, 51,254) # rgb = (0x00,0x33,0xfe) + ( 0, 52,255) # rgb = (0x00,0x34,0xff) + (255, 53, 7) # rgb = (0xff,0x35,0x07) + ( 0, 54,252) # rgb = (0x00,0x36,0xfc) + (254, 57, 7) # rgb = (0xfe,0x39,0x07) + (251, 57, 7) # rgb = (0xfb,0x39,0x07) + (247, 59, 7) # rgb = (0xf7,0x3b,0x07) + ( 0, 59, 61) # rgb = (0x00,0x3b,0x3d) + ( 0, 62,255) # rgb = (0x00,0x3e,0xff) + (142, 63, 5) # rgb = (0x8e,0x3f,0x05) + ( 0, 63,250) # rgb = (0x00,0x3f,0xfa) + (255, 63, 7) # rgb = (0xff,0x3f,0x07) + (253, 68, 7) # rgb = (0xfd,0x44,0x07) + ( 0, 73,255) # rgb = (0x00,0x49,0xff) + ( 0, 73,246) # rgb = (0x00,0x49,0xf6) + (255, 75, 7) # rgb = (0xff,0x4b,0x07) + ( 82, 85, 9) # rgb = (0x52,0x55,0x09) + (255, 85, 7) # rgb = (0xff,0x55,0x07) + ( 0, 89,255) # rgb = (0x00,0x59,0xff) + ( 0, 91,237) # rgb = (0x00,0x5b,0xed) + (255, 94, 7) # rgb = (0xff,0x5e,0x07) + (241,100, 7) # rgb = (0xf1,0x64,0x07) + ( 0,101,255) # rgb = (0x00,0x65,0xff) + (253,105, 7) # rgb = (0xfd,0x69,0x07) + ( 0,107,223) # rgb = (0x00,0x6b,0xdf) + (255,106, 7) # rgb = (0xff,0x6a,0x07) + ( 1,110, 95) # rgb = (0x01,0x6e,0x5f) + (255,115, 7) # rgb = (0xff,0x73,0x07) + ( 0,117,255) # rgb = (0x00,0x75,0xff) + (255,124, 7) # rgb = (0xff,0x7c,0x07) + (118,126, 10) # rgb = (0x76,0x7e,0x0a) + ( 0,130,250) # rgb = (0x00,0x82,0xfa) + ( 0,132,255) # rgb = (0x00,0x84,0xff) + ( 0,134,207) # rgb = (0x00,0x86,0xcf) + (255,134, 7) # rgb = (0xff,0x86,0x07) + ( 0,136,249) # rgb = (0x00,0x88,0xf9) + (219,140, 6) # rgb = (0xdb,0x8c,0x06) + ( 0,140,252) # rgb = (0x00,0x8c,0xfc) + ( 0,140,255) # rgb = (0x00,0x8c,0xff) + ( 1,142,136) # rgb = (0x01,0x8e,0x88) + (255,143, 7) # rgb = (0xff,0x8f,0x07) + (243,150, 7) # rgb = (0xf3,0x96,0x07) + (198,152, 7) # rgb = (0xc6,0x98,0x07) + (165,153, 7) # rgb = (0xa5,0x99,0x07) + ( 0,157,255) # rgb = (0x00,0x9d,0xff) + (255,158, 7) # rgb = (0xff,0x9e,0x07) + ( 70,159, 4) # rgb = (0x46,0x9f,0x04) + ( 0,160,251) # rgb = (0x00,0xa0,0xfb) + (203,163, 6) # rgb = (0xcb,0xa3,0x06) + ( 0,163,239) # rgb = (0x00,0xa3,0xef) + ( 1,164,178) # rgb = (0x01,0xa4,0xb2) + (255,166, 7) # rgb = (0xff,0xa6,0x07) + ( 1,169,165) # rgb = (0x01,0xa9,0xa5) + ( 1,170,255) # rgb = (0x01,0xaa,0xff) + (232,172, 6) # rgb = (0xe8,0xac,0x06) + (255,175, 7) # rgb = (0xff,0xaf,0x07) + (185,176,131) # rgb = (0xb9,0xb0,0x83) + ( 1,179,225) # rgb = (0x01,0xb3,0xe1) + (188,179,118) # rgb = (0xbc,0xb3,0x76) + (199,180, 6) # rgb = (0xc7,0xb4,0x06) + ( 1,182,255) # rgb = (0x01,0xb6,0xff) + ( 1,184,249) # rgb = (0x01,0xb8,0xf9) + (255,184, 7) # rgb = (0xff,0xb8,0x07) + (207,186, 71) # rgb = (0xcf,0xba,0x47) + (193,187, 6) # rgb = (0xc1,0xbb,0x06) + (253,191, 7) # rgb = (0xfd,0xbf,0x07) + (218,193, 48) # rgb = (0xda,0xc1,0x30) + ( 1,193,157) # rgb = (0x01,0xc1,0x9d) + ( 1,196,244) # rgb = (0x01,0xc4,0xf4) + ( 1,196,254) # rgb = (0x01,0xc4,0xfe) + ( 48,199, 3) # rgb = (0x30,0xc7,0x03) + (164,199, 5) # rgb = (0xa4,0xc7,0x05) + (220,202, 6) # rgb = (0xdc,0xca,0x06) + (253,203, 7) # rgb = (0xfd,0xcb,0x07) + ( 1,204,204) # rgb = (0x01,0xcc,0xcc) + (251,209, 7) # rgb = (0xfb,0xd1,0x07) + (231,208, 24) # rgb = (0xe7,0xd0,0x18) + ( 1,210,254) # rgb = (0x01,0xd2,0xfe) + ( 2,211,146) # rgb = (0x02,0xd3,0x92) + ( 1,212,156) # rgb = (0x01,0xd4,0x9c) + ( 1,213,252) # rgb = (0x01,0xd5,0xfc) + (237,219, 15) # rgb = (0xed,0xdb,0x0f) + ( 1,218,240) # rgb = (0x01,0xda,0xf0) + (165,220, 5) # rgb = (0xa5,0xdc,0x05) + ( 1,221,250) # rgb = (0x01,0xdd,0xfa) + (249,221, 6) # rgb = (0xf9,0xdd,0x06) + (146,222, 4) # rgb = (0x92,0xde,0x04) + ( 1,224,184) # rgb = (0x01,0xe0,0xb8) + ( 2,224,155) # rgb = (0x02,0xe0,0x9b) + (244,225, 10) # rgb = (0xf4,0xe1,0x0a) + (249,227, 7) # rgb = (0xf9,0xe3,0x07) + ( 2,229,133) # rgb = (0x02,0xe5,0x85) + (192,228, 6) # rgb = (0xc0,0xe4,0x06) + ( 37,230, 3) # rgb = (0x25,0xe6,0x03) + (246,230, 7) # rgb = (0xf6,0xe6,0x07) + (143,232, 4) # rgb = (0x8f,0xe8,0x04) + (244,233, 8) # rgb = (0xf4,0xe9,0x08) + ( 2,236,139) # rgb = (0x02,0xec,0x8b) + ( 1,236,227) # rgb = (0x01,0xec,0xe3) + ( 1,238,238) # rgb = (0x01,0xee,0xee) + (101,241, 4) # rgb = (0x65,0xf1,0x04) + ( 1,241,218) # rgb = (0x01,0xf1,0xda) + ( 1,240,232) # rgb = (0x01,0xf0,0xe8) + (167,240, 5) # rgb = (0xa7,0xf0,0x05) + ( 27,243, 2) # rgb = (0x1b,0xf3,0x02) + (126,243, 4) # rgb = (0x7e,0xf3,0x04) + ( 2,246,113) # rgb = (0x02,0xf6,0x71) + (133,248, 5) # rgb = (0x85,0xf8,0x05) + ( 22,250, 1) # rgb = (0x16,0xfa,0x01) + ( 2,249,219) # rgb = (0x02,0xf9,0xdb) + (148,250, 5) # rgb = (0x94,0xfa,0x05) + ( 2,250,199) # rgb = (0x02,0xfa,0xc7) + (183,252, 5) # rgb = (0xb7,0xfc,0x05) + (176,252, 5) # rgb = (0xb0,0xfc,0x05) + ( 2,252,211) # rgb = (0x02,0xfc,0xd3) + ( 2,252,190) # rgb = (0x02,0xfc,0xbe) + (164,251, 5) # rgb = (0xa4,0xfb,0x05) + ( 12,254,128) # rgb = (0x0c,0xfe,0x80) + (192,253, 5) # rgb = (0xc0,0xfd,0x05) + (164,253, 5) # rgb = (0xa4,0xfd,0x05) + ( 26,254, 85) # rgb = (0x1a,0xfe,0x55) + ( 14,254, 1) # rgb = (0x0e,0xfe,0x01) + (133,253, 5) # rgb = (0x85,0xfd,0x05) + ( 4,253,180) # rgb = (0x04,0xfd,0xb4) + (196,253, 5) # rgb = (0xc4,0xfd,0x05) + ( 2,253,198) # rgb = (0x02,0xfd,0xc6) + ( 3,255, 91) # rgb = (0x03,0xff,0x5b) + ( 3,255, 80) # rgb = (0x03,0xff,0x50) + (186,255, 5) # rgb = (0xba,0xff,0x05) + ( 9,255, 2) # rgb = (0x09,0xff,0x02) + ( 3,255,118) # rgb = (0x03,0xff,0x76) + ( 9,255, 3) # rgb = (0x09,0xff,0x03) + ( 10,255, 1) # rgb = (0x0a,0xff,0x01) + ( 3,255, 76) # rgb = (0x03,0xff,0x4c) + ( 3,255, 86) # rgb = (0x03,0xff,0x56) + ( 3,255, 82) # rgb = (0x03,0xff,0x52) + ( 13,255, 1) # rgb = (0x0d,0xff,0x01) + ( 3,255, 49) # rgb = (0x03,0xff,0x31) + ( 3,255,101) # rgb = (0x03,0xff,0x65) + ( 61,255, 32) # rgb = (0x3d,0xff,0x20) + (129,255, 5) # rgb = (0x81,0xff,0x05) + (177,255, 5) # rgb = (0xb1,0xff,0x05) + ( 3,255, 37) # rgb = (0x03,0xff,0x25) + (149,255, 5) # rgb = (0x95,0xff,0x05) + ( 7,255, 6) # rgb = (0x07,0xff,0x06) + (192,255, 5) # rgb = (0xc0,0xff,0x05) + ( 2,255,131) # rgb = (0x02,0xff,0x83) + ( 3,255, 98) # rgb = (0x03,0xff,0x62) + ( 85,255, 11) # rgb = (0x55,0xff,0x0b) + ( 2,255,163) # rgb = (0x02,0xff,0xa3) + ( 2,255,149) # rgb = (0x02,0xff,0x95) + ( 4,255, 23) # rgb = (0x04,0xff,0x17) + ( 6,255, 12) # rgb = (0x06,0xff,0x0c) + ( 3,255, 67) # rgb = (0x03,0xff,0x43) + (160,255, 5) # rgb = (0xa0,0xff,0x05) + (119,255, 6) # rgb = (0x77,0xff,0x06) + (102,255, 8) # rgb = (0x66,0xff,0x08) + (255,255,255) # rgb = (0xff,0xff,0xff) + (254,254,254) # rgb = (0xfe,0xfe,0xfe) + (254,254,254) # rgb = (0xfe,0xfe,0xfe) + (252,252,252) # rgb = (0xfc,0xfc,0xfc) + (252,252,252) # rgb = (0xfc,0xfc,0xfc) + (250,250,250) # rgb = (0xfa,0xfa,0xfa) + (250,250,250) # rgb = (0xfa,0xfa,0xfa) + (248,248,248) # rgb = (0xf8,0xf8,0xf8) + (248,248,248) # rgb = (0xf8,0xf8,0xf8) + (247,247,247) # rgb = (0xf7,0xf7,0xf7) + (245,245,245) # rgb = (0xf5,0xf5,0xf5) + (245,245,245) # rgb = (0xf5,0xf5,0xf5) + (243,243,243) # rgb = (0xf3,0xf3,0xf3) + (243,243,243) # rgb = (0xf3,0xf3,0xf3) + (241,241,241) # rgb = (0xf1,0xf1,0xf1) + (241,241,241) # rgb = (0xf1,0xf1,0xf1) + (239,239,239) # rgb = (0xef,0xef,0xef) + (238,238,238) # rgb = (0xee,0xee,0xee) + (238,238,238) # rgb = (0xee,0xee,0xee) + (236,236,236) # rgb = (0xec,0xec,0xec) + (236,236,236) # rgb = (0xec,0xec,0xec) + (234,234,234) # rgb = (0xea,0xea,0xea) + (234,234,234) # rgb = (0xea,0xea,0xea) + (232,232,232) # rgb = (0xe8,0xe8,0xe8) + (231,231,231) # rgb = (0xe7,0xe7,0xe7) + (231,231,231) # rgb = (0xe7,0xe7,0xe7) + (229,229,229) # rgb = (0xe5,0xe5,0xe5) + (229,229,229) # rgb = (0xe5,0xe5,0xe5) + (227,227,227) # rgb = (0xe3,0xe3,0xe3) + (226,226,226) # rgb = (0xe2,0xe2,0xe2) + (226,226,226) # rgb = (0xe2,0xe2,0xe2) + (224,224,224) # rgb = (0xe0,0xe0,0xe0) + (224,224,224) # rgb = (0xe0,0xe0,0xe0) + (222,222,222) # rgb = (0xde,0xde,0xde) + (222,222,222) # rgb = (0xde,0xde,0xde) + (220,220,220) # rgb = (0xdc,0xdc,0xdc) + (219,219,219) # rgb = (0xdb,0xdb,0xdb) + (219,219,219) # rgb = (0xdb,0xdb,0xdb) + (217,217,217) # rgb = (0xd9,0xd9,0xd9) + (217,217,217) # rgb = (0xd9,0xd9,0xd9) + (215,215,215) # rgb = (0xd7,0xd7,0xd7) + (214,214,214) # rgb = (0xd6,0xd6,0xd6) + (214,214,214) # rgb = (0xd6,0xd6,0xd6) + (212,212,212) # rgb = (0xd4,0xd4,0xd4) + (212,212,212) # rgb = (0xd4,0xd4,0xd4) + (210,210,210) # rgb = (0xd2,0xd2,0xd2) + (209,209,209) # rgb = (0xd1,0xd1,0xd1) + (209,209,209) # rgb = (0xd1,0xd1,0xd1) + (207,207,207) # rgb = (0xcf,0xcf,0xcf) + (205,205,205) # rgb = (0xcd,0xcd,0xcd) + (205,205,205) # rgb = (0xcd,0xcd,0xcd) + (204,204,204) # rgb = (0xcc,0xcc,0xcc) + (204,204,204) # rgb = (0xcc,0xcc,0xcc) + (202,202,202) # rgb = (0xca,0xca,0xca) + (201,201,201) # rgb = (0xc9,0xc9,0xc9) + (201,201,201) # rgb = (0xc9,0xc9,0xc9) + (199,199,199) # rgb = (0xc7,0xc7,0xc7) + (199,199,199) # rgb = (0xc7,0xc7,0xc7) + (197,197,197) # rgb = (0xc5,0xc5,0xc5) + (196,196,196) # rgb = (0xc4,0xc4,0xc4) + (196,196,196) # rgb = (0xc4,0xc4,0xc4) + (194,194,194) # rgb = (0xc2,0xc2,0xc2) + (193,193,193) # rgb = (0xc1,0xc1,0xc1) + (193,193,193) # rgb = (0xc1,0xc1,0xc1) + (191,191,191) # rgb = (0xbf,0xbf,0xbf) + (191,191,191) # rgb = (0xbf,0xbf,0xbf) + (189,189,189) # rgb = (0xbd,0xbd,0xbd) + (188,188,188) # rgb = (0xbc,0xbc,0xbc) + (188,188,188) # rgb = (0xbc,0xbc,0xbc) + (186,186,186) # rgb = (0xba,0xba,0xba) + (185,185,185) # rgb = (0xb9,0xb9,0xb9) + (185,185,185) # rgb = (0xb9,0xb9,0xb9) + (183,183,183) # rgb = (0xb7,0xb7,0xb7) + (182,182,182) # rgb = (0xb6,0xb6,0xb6) + (182,182,182) # rgb = (0xb6,0xb6,0xb6) + (180,180,180) # rgb = (0xb4,0xb4,0xb4) + (178,178,178) # rgb = (0xb2,0xb2,0xb2) + (178,178,178) # rgb = (0xb2,0xb2,0xb2) + (177,177,177) # rgb = (0xb1,0xb1,0xb1) + (177,177,177) # rgb = (0xb1,0xb1,0xb1) + (175,175,175) # rgb = (0xaf,0xaf,0xaf) + (174,174,174) # rgb = (0xae,0xae,0xae) + (174,174,174) # rgb = (0xae,0xae,0xae) +} +tRNS { + 197 187 190 194 186 4 186 189 4 195 84 191 5 193 175 163 205 150 191 213 88 75 67 8 147 191 220 203 95 151 223 199 8 207 156 227 199 65 163 98 226 204 12 202 167 201 11 65 178 228 205 74 59 87 178 19 201 99 18 14 184 204 184 96 22 61 227 199 22 193 97 197 254 59 253 28 192 102 199 247 58 198 244 30 109 202 188 32 96 196 60 203 239 202 230 41 207 237 119 53 213 209 37 55 45 230 214 233 92 185 223 50 230 57 124 217 43 133 221 95 198 47 233 99 194 221 107 138 152 144 226 140 133 220 172 125 218 196 118 225 161 223 235 238 200 155 147 146 172 236 236 151 183 150 234 216 217 211 151 219 132 185 145 147 217 138 144 137 142 151 217 217 213} +IMAGE { + pixels hex +0520201616160a0a0a0a0a0a0a0a010101010101010101000000000000000000 +053a3a161616160a0a0a0a0a0a0a0a0a0a06060606060607070707070707071b +053a3a3a161616161615151c1c1c1c1c1c1c12121212121b1b1b1b1b1b1b1b1b +053a3a3a3a252525252527272727272727272724242424242424212121212121 +053a3a3a4034343425252727272727393939392d2d2d2d2d2d2d323232323232 +053a3a404034343434343939393939393939394747474343433d3d3d3d3d3d3d +053a404b4b4b50505046464646464646464659595959595151514e5b5b616161 +053a404b4b4b50505058585858585858588c8c8c595959595b656a6e70707070 +053a4b4b4b4b5050506c5858585858588c8c8c8c8c8c5965656a6a6e70707070 +053b4b4b4b636363506c6c6c6c6c6c8781808c8c8c86a1a1a1906e6e70707070 +053b4b5757636363636c6c6c6c7787878181808c8c86a1a190909d9d9d9daa70 +053b576666666f6363777777777e8787848481808086a19090aaaaaaaa9f9f9f +053b576666797979797b7b7b7b7b8a8a8a8a848480809c9c9c9c9c9c9c9c9c9c +053b66747474747474747b7b7b7b8a8a8a8a8a8aacacacacacacacacacaca4a4 +052e7474747474747474747b7b7b8a8a8a6d6d6d6d6d6d6da4a4a4a4a4a4a4a4 +052e7474747474747474a0a0a0a0a0a09393936d6d6d6d787878787878787878 +05207474747474a0a0a0a0a0a0a0a0a093939191949494948989898989898989 +052a2a2a7171717171a7a7a7a7a7a7a7a7a79e9e9e9e9e9e9e9e959595959595 +052a53536871717171717171a9a9a9a9a9a9a9a9a9a9a9a99595959595959595 +053753536871717171717171a3a3a3a3a3a3a3a3979797979a9a9a9a8e8e8e8e +05445353686871717171717171a5a2a2a2a2a2929292928585857a7a7a7a7a7a +054453535f68687171717171a5a5a5a5a5a5a6a6a6a6a68b8b8b8b8b8b8b8b6b +054444535f686767676767677272727f7f8383838383838d8d8d8d8d8d8d8b8b +054444535f6767675a5a5a627272727275757f7f7f7f5d73737d7d7d82828282 +0544445367675a5a5a5a4d546262727272757575755d5d5d7373737376767676 +054444535349495a5a5a4d4d54626262626275754c5d5d5d5d60646464767676 +054444444949494949494d4d4d5454546262624c4c4c4c4c5555556060646464 +05444444444941414133353f3f3f3f3f3f4d3636363c3c454545454531313131 +05444444442f2f2f2f333535353535352c2c2c2c2c3030303030282828282828 +053744442f2f2f2f2f2f333535351d1d22222222262626262323232323232323 +053737372f2f2f2f2f2f2f331818181818181d1d1d1d1d131a1a1a1a1a1e1e1e +052a37372f2f2f2f2f2f18111111110f0e0e0e0e0d0d0d0d0d0d0d0d0d0d0d13 +} diff --git a/libgo/go/json/decode.go b/libgo/go/json/decode.go index 4f6562bd552..b7129f9846a 100644 --- a/libgo/go/json/decode.go +++ b/libgo/go/json/decode.go @@ -140,6 +140,7 @@ type decodeState struct { scan scanner nextscan scanner // for calls to nextValue savedError os.Error + tempstr string // scratch space to avoid some allocations } // errPhase is used for errors that should not happen unless @@ -470,6 +471,8 @@ func (d *decodeState) object(v reflect.Value) { // Figure out field corresponding to key. var subv reflect.Value + destring := false // whether the value is wrapped in a string to be decoded first + if mv.IsValid() { elemType := mv.Type().Elem() if !mapElem.IsValid() { @@ -486,7 +489,8 @@ func (d *decodeState) object(v reflect.Value) { if isValidTag(key) { for i := 0; i < sv.NumField(); i++ { f = st.Field(i) - if f.Tag.Get("json") == key { + tagName, _ := parseTag(f.Tag.Get("json")) + if tagName == key { ok = true break } @@ -508,6 +512,8 @@ func (d *decodeState) object(v reflect.Value) { } else { subv = sv.FieldByIndex(f.Index) } + _, opts := parseTag(f.Tag.Get("json")) + destring = opts.Contains("string") } } @@ -520,8 +526,12 @@ func (d *decodeState) object(v reflect.Value) { } // Read value. - d.value(subv) - + if destring { + d.value(reflect.ValueOf(&d.tempstr)) + d.literalStore([]byte(d.tempstr), subv) + } else { + d.value(subv) + } // Write value back to map; // if using struct, subv points into struct already. if mv.IsValid() { @@ -550,8 +560,12 @@ func (d *decodeState) literal(v reflect.Value) { // Scan read one byte too far; back up. d.off-- d.scan.undo(op) - item := d.data[start:d.off] + d.literalStore(d.data[start:d.off], v) +} + +// literalStore decodes a literal stored in item into v. +func (d *decodeState) literalStore(item []byte, v reflect.Value) { // Check for unmarshaler. wantptr := item[0] == 'n' // null unmarshaler, pv := d.indirect(v, wantptr) diff --git a/libgo/go/json/decode_test.go b/libgo/go/json/decode_test.go index a855d604866..5f6c3f5b8d0 100644 --- a/libgo/go/json/decode_test.go +++ b/libgo/go/json/decode_test.go @@ -262,7 +262,10 @@ type All struct { Float32 float32 Float64 float64 - Foo string `json:"bar"` + Foo string `json:"bar"` + Foo2 string `json:"bar2,dummyopt"` + + IntStr int64 `json:",string"` PBool *bool PInt *int @@ -331,6 +334,8 @@ var allValue = All{ Float32: 14.1, Float64: 15.1, Foo: "foo", + Foo2: "foo2", + IntStr: 42, String: "16", Map: map[string]Small{ "17": {Tag: "tag17"}, @@ -391,6 +396,8 @@ var allValueIndent = `{ "Float32": 14.1, "Float64": 15.1, "bar": "foo", + "bar2": "foo2", + "IntStr": "42", "PBool": null, "PInt": null, "PInt8": null, @@ -481,6 +488,8 @@ var pallValueIndent = `{ "Float32": 0, "Float64": 0, "bar": "", + "bar2": "", + "IntStr": "0", "PBool": true, "PInt": 2, "PInt8": 3, diff --git a/libgo/go/json/encode.go b/libgo/go/json/encode.go index 3e593fec15f..16be5e2af16 100644 --- a/libgo/go/json/encode.go +++ b/libgo/go/json/encode.go @@ -4,6 +4,9 @@ // Package json implements encoding and decoding of JSON objects as defined in // RFC 4627. +// +// See "JSON and Go" for an introduction to this package: +// http://blog.golang.org/2011/01/json-and-go.html package json import ( @@ -14,7 +17,6 @@ import ( "runtime" "sort" "strconv" - "strings" "unicode" "utf8" ) @@ -59,6 +61,12 @@ import ( // // Note the leading comma. // Field int `json:",omitempty"` // +// The "string" option signals that a field is stored as JSON inside a +// JSON-encoded string. This extra level of encoding is sometimes +// used when communicating with JavaScript programs: +// +// Int64String int64 `json:",string"` +// // The key name will be used if it's a non-empty string consisting of // only Unicode letters, digits, dollar signs, hyphens, and underscores. // @@ -221,6 +229,12 @@ func isEmptyValue(v reflect.Value) bool { } func (e *encodeState) reflectValue(v reflect.Value) { + e.reflectValueQuoted(v, false) +} + +// reflectValueQuoted writes the value in v to the output. +// If quoted is true, the serialization is wrapped in a JSON string. +func (e *encodeState) reflectValueQuoted(v reflect.Value, quoted bool) { if !v.IsValid() { e.WriteString("null") return @@ -238,26 +252,39 @@ func (e *encodeState) reflectValue(v reflect.Value) { return } + writeString := (*encodeState).WriteString + if quoted { + writeString = (*encodeState).string + } + switch v.Kind() { case reflect.Bool: x := v.Bool() if x { - e.WriteString("true") + writeString(e, "true") } else { - e.WriteString("false") + writeString(e, "false") } case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - e.WriteString(strconv.Itoa64(v.Int())) + writeString(e, strconv.Itoa64(v.Int())) case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - e.WriteString(strconv.Uitoa64(v.Uint())) + writeString(e, strconv.Uitoa64(v.Uint())) case reflect.Float32, reflect.Float64: - e.WriteString(strconv.FtoaN(v.Float(), 'g', -1, v.Type().Bits())) + writeString(e, strconv.FtoaN(v.Float(), 'g', -1, v.Type().Bits())) case reflect.String: - e.string(v.String()) + if quoted { + sb, err := Marshal(v.String()) + if err != nil { + e.error(err) + } + e.string(string(sb)) + } else { + e.string(v.String()) + } case reflect.Struct: e.WriteByte('{') @@ -269,17 +296,14 @@ func (e *encodeState) reflectValue(v reflect.Value) { if f.PkgPath != "" { continue } - tag, omitEmpty := f.Name, false + tag, omitEmpty, quoted := f.Name, false, false if tv := f.Tag.Get("json"); tv != "" { - ss := strings.SplitN(tv, ",", 2) - if isValidTag(ss[0]) { - tag = ss[0] - } - if len(ss) > 1 { - // Currently the only option is omitempty, - // so parsing is trivial. - omitEmpty = ss[1] == "omitempty" + name, opts := parseTag(tv) + if isValidTag(name) { + tag = name } + omitEmpty = opts.Contains("omitempty") + quoted = opts.Contains("string") } fieldValue := v.Field(i) if omitEmpty && isEmptyValue(fieldValue) { @@ -292,7 +316,7 @@ func (e *encodeState) reflectValue(v reflect.Value) { } e.string(tag) e.WriteByte(':') - e.reflectValue(fieldValue) + e.reflectValueQuoted(fieldValue, quoted) } e.WriteByte('}') @@ -380,7 +404,8 @@ func (sv stringValues) Swap(i, j int) { sv[i], sv[j] = sv[j], sv[i] } func (sv stringValues) Less(i, j int) bool { return sv.get(i) < sv.get(j) } func (sv stringValues) get(i int) string { return sv[i].String() } -func (e *encodeState) string(s string) { +func (e *encodeState) string(s string) (int, os.Error) { + len0 := e.Len() e.WriteByte('"') start := 0 for i := 0; i < len(s); { @@ -425,4 +450,5 @@ func (e *encodeState) string(s string) { e.WriteString(s[start:]) } e.WriteByte('"') + return e.Len() - len0, nil } diff --git a/libgo/go/json/encode_test.go b/libgo/go/json/encode_test.go index 0e4b637703d..012e9f143b4 100644 --- a/libgo/go/json/encode_test.go +++ b/libgo/go/json/encode_test.go @@ -5,6 +5,8 @@ package json import ( + "bytes" + "reflect" "testing" ) @@ -42,3 +44,39 @@ func TestOmitEmpty(t *testing.T) { t.Errorf(" got: %s\nwant: %s\n", got, optionalsExpected) } } + +type StringTag struct { + BoolStr bool `json:",string"` + IntStr int64 `json:",string"` + StrStr string `json:",string"` +} + +var stringTagExpected = `{ + "BoolStr": "true", + "IntStr": "42", + "StrStr": "\"xzbit\"" +}` + +func TestStringTag(t *testing.T) { + var s StringTag + s.BoolStr = true + s.IntStr = 42 + s.StrStr = "xzbit" + got, err := MarshalIndent(&s, "", " ") + if err != nil { + t.Fatal(err) + } + if got := string(got); got != stringTagExpected { + t.Fatalf(" got: %s\nwant: %s\n", got, stringTagExpected) + } + + // Verify that it round-trips. + var s2 StringTag + err = NewDecoder(bytes.NewBuffer(got)).Decode(&s2) + if err != nil { + t.Fatalf("Decode: %v", err) + } + if !reflect.DeepEqual(s, s2) { + t.Fatalf("decode didn't match.\nsource: %#v\nEncoded as:\n%s\ndecode: %#v", s, string(got), s2) + } +} diff --git a/libgo/go/json/tags.go b/libgo/go/json/tags.go new file mode 100644 index 00000000000..58cda2027c6 --- /dev/null +++ b/libgo/go/json/tags.go @@ -0,0 +1,44 @@ +// Copyright 2011 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 json + +import ( + "strings" +) + +// tagOptions is the string following a comma in a struct field's "json" +// tag, or the empty string. It does not include the leading comma. +type tagOptions string + +// parseTag splits a struct field's json tag into its name and +// comma-separated options. +func parseTag(tag string) (string, tagOptions) { + if idx := strings.Index(tag, ","); idx != -1 { + return tag[:idx], tagOptions(tag[idx+1:]) + } + return tag, tagOptions("") +} + +// Contains returns whether checks that a comma-separated list of options +// contains a particular substr flag. substr must be surrounded by a +// string boundary or commas. +func (o tagOptions) Contains(optionName string) bool { + if len(o) == 0 { + return false + } + s := string(o) + for s != "" { + var next string + i := strings.Index(s, ",") + if i >= 0 { + s, next = s[:i], s[i+1:] + } + if s == optionName { + return true + } + s = next + } + return false +} diff --git a/libgo/go/json/tags_test.go b/libgo/go/json/tags_test.go new file mode 100644 index 00000000000..91fb18831e2 --- /dev/null +++ b/libgo/go/json/tags_test.go @@ -0,0 +1,28 @@ +// Copyright 2011 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 json + +import ( + "testing" +) + +func TestTagParsing(t *testing.T) { + name, opts := parseTag("field,foobar,foo") + if name != "field" { + t.Fatalf("name = %q, want field", name) + } + for _, tt := range []struct { + opt string + want bool + }{ + {"foobar", true}, + {"foo", true}, + {"bar", false}, + } { + if opts.Contains(tt.opt) != tt.want { + t.Errorf("Contains(%q) = %v", tt.opt, !tt.want) + } + } +} diff --git a/libgo/go/reflect/type.go b/libgo/go/reflect/type.go index b825768568f..6d0f4542431 100644 --- a/libgo/go/reflect/type.go +++ b/libgo/go/reflect/type.go @@ -10,6 +10,9 @@ // A call to ValueOf returns a Value representing the run-time data. // Zero takes a Type and returns a Value representing a zero value // for that type. +// +// See "The Laws of Reflection" for an introduction to reflection in Go: +// http://blog.golang.org/2011/09/laws-of-reflection.html package reflect import ( diff --git a/libgo/merge.sh b/libgo/merge.sh index 3c520ef3bf9..59e1df2018f 100644..100755 --- a/libgo/merge.sh +++ b/libgo/merge.sh @@ -40,7 +40,7 @@ hg clone -r ${old_rev} ${repository} ${OLDDIR} rm -rf ${NEWDIR} hg clone -u release ${repository} ${NEWDIR} -new_rev=`cd ${NEWDIR} && hg log | sed 1q | sed -e 's/.*://'` +new_rev=`cd ${NEWDIR} && hg log -r release | sed 1q | sed -e 's/.*://'` merge() { name=$1 diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh index edeb3168a8a..2bc35e5b883 100755 --- a/libgo/mksysinfo.sh +++ b/libgo/mksysinfo.sh @@ -43,6 +43,7 @@ cat > sysinfo.c <<EOF #include <netinet/tcp.h> #include <signal.h> #include <sys/ioctl.h> +#include <termios.h> #if defined(HAVE_SYSCALL_H) #include <syscall.h> #endif diff --git a/libgo/runtime/go-make-slice.c b/libgo/runtime/go-make-slice.c index cd2d55bd538..d0e8369c1f6 100644 --- a/libgo/runtime/go-make-slice.c +++ b/libgo/runtime/go-make-slice.c @@ -35,7 +35,8 @@ __go_make_slice2 (const struct __go_type_descriptor *td, uintptr_t len, icap = (int) cap; if (cap < len || (uintptr_t) icap != cap - || cap > (uintptr_t) -1U / std->__element_type->__size) + || (std->__element_type->__size > 0 + && cap > (uintptr_t) -1U / std->__element_type->__size)) __go_panic_msg ("makeslice: cap out of range"); ret.__count = ilen; diff --git a/libgo/runtime/go-map-delete.c b/libgo/runtime/go-map-delete.c index 7a3a7b83d92..9b19ff19df4 100644 --- a/libgo/runtime/go-map-delete.c +++ b/libgo/runtime/go-map-delete.c @@ -9,6 +9,7 @@ #include "go-alloc.h" #include "go-assert.h" +#include "go-panic.h" #include "map.h" /* Delete the entry matching KEY from MAP. */ @@ -25,6 +26,9 @@ __go_map_delete (struct __go_map *map, const void *key) size_t bucket_index; void **pentry; + if (map == NULL) + __go_panic_msg ("assignment to entry in nil map"); + descriptor = map->__descriptor; key_descriptor = descriptor->__map_descriptor->__key_type; diff --git a/libgo/runtime/go-map-index.c b/libgo/runtime/go-map-index.c index a387c4b98bc..92a806868bc 100644 --- a/libgo/runtime/go-map-index.c +++ b/libgo/runtime/go-map-index.c @@ -9,6 +9,7 @@ #include "go-alloc.h" #include "go-assert.h" +#include "go-panic.h" #include "map.h" /* Rehash MAP to a larger size. */ @@ -85,6 +86,13 @@ __go_map_index (struct __go_map *map, const void *key, _Bool insert) size_t bucket_index; char *entry; + if (map == NULL) + { + if (insert) + __go_panic_msg ("assignment to entry in nil map"); + return NULL; + } + descriptor = map->__descriptor; key_descriptor = descriptor->__map_descriptor->__key_type; diff --git a/libgo/runtime/go-new-channel.c b/libgo/runtime/go-new-channel.c index 0c6f39185de..2f5bf2ea20a 100644 --- a/libgo/runtime/go-new-channel.c +++ b/libgo/runtime/go-new-channel.c @@ -33,7 +33,7 @@ __go_new_channel (const struct __go_type_descriptor *channel_type, ientries = (int) entries; if (ientries < 0 || (uintptr_t) ientries != entries - || entries > (uintptr_t) -1 / element_size) + || (element_size > 0 && entries > (uintptr_t) -1 / element_size)) __go_panic_msg ("chan size out of range"); alloc_size = (element_size + sizeof (uint64_t) - 1) / sizeof (uint64_t); diff --git a/libgo/runtime/map.goc b/libgo/runtime/map.goc index d6308cbd308..e19bc96de64 100644 --- a/libgo/runtime/map.goc +++ b/libgo/runtime/map.goc @@ -9,17 +9,18 @@ package runtime typedef unsigned char byte; typedef _Bool bool; -typedef struct __go_map hmap; +typedef struct __go_map_type MapType; +typedef struct __go_map Hmap; typedef struct __go_hash_iter hiter; /* Access a value in a map, returning a value and a presence indicator. */ -func mapaccess2(h *hmap, key *byte, val *byte) (present bool) { +func mapaccess2(t *MapType, h *Hmap, key *byte, val *byte) (present bool) { byte *mapval; size_t valsize; mapval = __go_map_index(h, key, 0); - valsize = h->__descriptor->__map_descriptor->__val_type->__size; + valsize = t->__val_type->__size; if (mapval == nil) { __builtin_memset(val, 0, valsize); present = 0; @@ -31,7 +32,7 @@ func mapaccess2(h *hmap, key *byte, val *byte) (present bool) { /* Optionally assign a value to a map (m[k] = v, p). */ -func mapassign2(h *hmap, key *byte, val *byte, p bool) { +func mapassign2(h *Hmap, key *byte, val *byte, p bool) { if (!p) { __go_map_delete(h, key); } else { @@ -46,7 +47,7 @@ func mapassign2(h *hmap, key *byte, val *byte, p bool) { /* Initialize a range over a map. */ -func mapiterinit(h *hmap, it *hiter) { +func mapiterinit(h *Hmap, it *hiter) { __go_mapiterinit(h, it); } diff --git a/libgo/syscalls/exec.go b/libgo/syscalls/exec.go index 04d0ef88f82..8ad45f9aea5 100644 --- a/libgo/syscalls/exec.go +++ b/libgo/syscalls/exec.go @@ -231,6 +231,7 @@ var zeroSysProcAttr SysProcAttr func forkExec(argv0 string, argv []string, attr *ProcAttr) (pid int, err int) { var p [2]int + var n Ssize_t var r1 int var err1 uintptr var wstatus WaitStatus @@ -283,20 +284,14 @@ func forkExec(argv0 string, argv []string, attr *ProcAttr) (pid int, err int) { // Kick off child. pid, err = forkAndExecInChild(argv0p, argvp, envvp, chroot, dir, attr, sys, p[1]) if err != 0 { - error: - if p[0] >= 0 { - Close(p[0]) - Close(p[1]) - } - ForkLock.Unlock() - return 0, err + goto error } ForkLock.Unlock() // Read child error status from pipe. Close(p[1]) - n := libc_read(p[0], (*byte)(unsafe.Pointer(&err1)), - Size_t(unsafe.Sizeof(err1))) + n = libc_read(p[0], (*byte)(unsafe.Pointer(&err1)), + Size_t(unsafe.Sizeof(err1))) err = 0 if n < 0 { err = GetErrno() @@ -321,6 +316,14 @@ func forkExec(argv0 string, argv []string, attr *ProcAttr) (pid int, err int) { // Read got EOF, so pipe closed on exec, so exec succeeded. return pid, 0 + +error: + if p[0] >= 0 { + Close(p[0]) + Close(p[1]) + } + ForkLock.Unlock() + return 0, err } // Combination of fork and exec, careful to be thread safe. diff --git a/libgo/testsuite/gotest b/libgo/testsuite/gotest index 83640782835..296e8a5168f 100755 --- a/libgo/testsuite/gotest +++ b/libgo/testsuite/gotest @@ -32,7 +32,7 @@ loop=true keep=false prefix= dejagnu=no -timeout=60 +timeout=240 testname="" trace=false while $loop; do |