diff options
Diffstat (limited to 'src/pkg/unicode/utf8/utf8_test.go')
-rw-r--r-- | src/pkg/unicode/utf8/utf8_test.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/pkg/unicode/utf8/utf8_test.go b/src/pkg/unicode/utf8/utf8_test.go index 63514265b..4f73c8fb8 100644 --- a/src/pkg/unicode/utf8/utf8_test.go +++ b/src/pkg/unicode/utf8/utf8_test.go @@ -7,9 +7,30 @@ package utf8_test import ( "bytes" "testing" + "unicode" . "unicode/utf8" ) +// Validate the constants redefined from unicode. +func init() { + if MaxRune != unicode.MaxRune { + panic("utf8.MaxRune is wrong") + } + if RuneError != unicode.ReplacementChar { + panic("utf8.RuneError is wrong") + } +} + +// Validate the constants redefined from unicode. +func TestConstants(t *testing.T) { + if MaxRune != unicode.MaxRune { + t.Errorf("utf8.MaxRune is wrong: %x should be %x", MaxRune, unicode.MaxRune) + } + if RuneError != unicode.ReplacementChar { + t.Errorf("utf8.RuneError is wrong: %x should be %x", RuneError, unicode.ReplacementChar) + } +} + type Utf8Map struct { r rune str string |