add MarshalJSON and UnmarshalJSON to BitArray (#200)

See CHANGELOG
This commit is contained in:
Anton Kaliaev
2018-04-23 09:16:05 +02:00
committed by Jae Kwon
parent 8fa4211bbd
commit d94e312673
5 changed files with 155 additions and 12 deletions

View File

@ -49,3 +49,18 @@ func TestSplitAndTrim(t *testing.T) {
assert.Equal(t, tc.expected, SplitAndTrim(tc.s, tc.sep, tc.cutset), "%s", tc.s)
}
}
func TestIsASCIIText(t *testing.T) {
notASCIIText := []string{
"", "\xC2", "\xC2\xA2", "\xFF", "\x80", "\xF0", "\n", "\t",
}
for _, v := range notASCIIText {
assert.False(t, IsHex(v), "%q is not ascii-text", v)
}
asciiText := []string{
" ", ".", "x", "$", "_", "abcdefg;", "-", "0x00", "0", "123",
}
for _, v := range asciiText {
assert.True(t, IsASCIIText(v), "%q is ascii-text", v)
}
}