aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/xml/xml_test.go
diff options
context:
space:
mode:
authorArtyom Pervukhin <artyom.pervukhin@gmail.com>2018-04-26 14:23:54 +0100
committerIan Lance Taylor <iant@golang.org>2018-05-09 17:31:08 +0000
commit4410934cbad454539312468aca276111c08f5582 (patch)
treee9000e3f867970c79026c5f047e05152464b43f3 /src/encoding/xml/xml_test.go
parent46047e64479c30602f0fb42c6915638006d7335d (diff)
downloadgo-4410934cbad454539312468aca276111c08f5582.tar.xz
encoding/xml: fix valid character range
Section 2.2 of the referenced spec http://www.xml.com/axml/testaxml.htm defines 0xD7FF as a (sub)range boundary, not 0xDF77. Fixes #25172 Change-Id: Ic5a3328cd46ef6474b8e93c4a343dcfba0e6511f Reviewed-on: https://go-review.googlesource.com/109495 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/encoding/xml/xml_test.go')
-rw-r--r--src/encoding/xml/xml_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/encoding/xml/xml_test.go b/src/encoding/xml/xml_test.go
index 7a3511d583..ee4ffa2420 100644
--- a/src/encoding/xml/xml_test.go
+++ b/src/encoding/xml/xml_test.go
@@ -650,6 +650,20 @@ func TestDisallowedCharacters(t *testing.T) {
}
}
+func TestIsInCharacterRange(t *testing.T) {
+ invalid := []rune{
+ utf8.MaxRune + 1,
+ 0xD800, // surrogate min
+ 0xDFFF, // surrogate max
+ -1,
+ }
+ for _, r := range invalid {
+ if isInCharacterRange(r) {
+ t.Errorf("rune %U considered valid", r)
+ }
+ }
+}
+
var procInstTests = []struct {
input string
expect [2]string