aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/xml/xml_test.go
diff options
context:
space:
mode:
authorJes Cok <xigua67damn@gmail.com>2024-02-07 04:56:26 +0000
committerGopher Robot <gobot@golang.org>2024-02-08 20:33:51 +0000
commit414161ebfaa58218ffac7907b4d8ef2babb236cb (patch)
tree9e8b078fcd9799a9c5092e4e94e8dcf85bebbbd3 /src/encoding/xml/xml_test.go
parenta56834922fb0acfede96aa2ff19d703d022f391b (diff)
downloadgo-414161ebfaa58218ffac7907b4d8ef2babb236cb.tar.xz
encoding/xml: rewrite func procInst
This CL tries to make function procInst more exact, also adds test cases, however, including tricky ones. Change-Id: If421299fc84d136e56a25dba7a4919c4424702c8 GitHub-Last-Rev: b9a3192718ae5535d66fddd260c27b48d93b4af1 GitHub-Pull-Request: golang/go#64336 Reviewed-on: https://go-review.googlesource.com/c/go/+/544475 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/encoding/xml/xml_test.go')
-rw-r--r--src/encoding/xml/xml_test.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/encoding/xml/xml_test.go b/src/encoding/xml/xml_test.go
index 42f5f5f8a6..4bec4e7f1e 100644
--- a/src/encoding/xml/xml_test.go
+++ b/src/encoding/xml/xml_test.go
@@ -830,6 +830,13 @@ var procInstTests = []struct {
{`version="1.0" encoding='utf-8' `, [2]string{"1.0", "utf-8"}},
{`version="1.0" encoding=utf-8`, [2]string{"1.0", ""}},
{`encoding="FOO" `, [2]string{"", "FOO"}},
+ {`version=2.0 version="1.0" encoding=utf-7 encoding='utf-8'`, [2]string{"1.0", "utf-8"}},
+ {`version= encoding=`, [2]string{"", ""}},
+ {`encoding="version=1.0"`, [2]string{"", "version=1.0"}},
+ {``, [2]string{"", ""}},
+ // TODO: what's the right approach to handle these nested cases?
+ {`encoding="version='1.0'"`, [2]string{"1.0", "version='1.0'"}},
+ {`version="encoding='utf-8'"`, [2]string{"encoding='utf-8'", "utf-8"}},
}
func TestProcInstEncoding(t *testing.T) {