2020-06-23 08:44:04 +03:00
|
|
|
package mapobjectdb
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
"unicode/utf8"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestInvalidUtf8(t *testing.T) {
|
|
|
|
if utf8.Valid([]byte{0xe1, 0x7f, 0xc7}) {
|
|
|
|
t.Error("should be invalid")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestValidUtf8(t *testing.T) {
|
|
|
|
if !utf8.Valid([]byte("some valid string")) {
|
|
|
|
t.Error("should be valid")
|
|
|
|
}
|
|
|
|
}
|
2020-06-23 08:45:37 +03:00
|
|
|
|
|
|
|
func TestEmptyString(t *testing.T) {
|
|
|
|
if !utf8.Valid([]byte("")) {
|
|
|
|
t.Error("should be valid")
|
|
|
|
}
|
|
|
|
}
|