ui/app: merge goString implementations and add test

Fixes gio#30

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-08-26 21:19:58 +01:00
parent 7d47fe0fc9
commit 069bb0e7cd
4 changed files with 45 additions and 48 deletions
+18
View File
@@ -0,0 +1,18 @@
package gl
import (
"testing"
)
func TestGoString(t *testing.T) {
tests := [][2]string{
{"Hello\x00", "Hello"},
{"\x00", ""},
}
for _, test := range tests {
got := GoString([]byte(test[0]))
if exp := test[1]; exp != got {
t.Errorf("expected %q got %q", exp, got)
}
}
}