feat: add IsPrintable

This commit is contained in:
dudaodong committed 2023-03-31 12:00:32 +08:00
1 parent 217350042b
commit bc25e7a037
5 files changed
+132 -3

No files matched your search

+10
View File
@@ -411,3 +411,13 @@ func TestIsASCII(t *testing.T) {
assert.Equal(false, IsASCII("😄"))
assert.Equal(false, IsASCII("你好"))
}
func TestIsPrintable(t *testing.T) {
assert := internal.NewAssert(t, "TestIsPrintable")
assert.Equal(true, IsPrintable("ABC"))
assert.Equal(true, IsPrintable("{id: 123}"))
assert.Equal(true, IsPrintable(""))
assert.Equal(true, IsPrintable("😄"))
assert.Equal(false, IsPrintable("\u0000"))
}