Esempio n. 1
0
func TestFlagSetError(t *testing.T) {
	var v zbase32.Value
	switch err := v.Set("bad input!"); err := err.(type) {
	case zbase32.CorruptInputError:
		// ok
	default:
		t.Fatalf("wrong error: %T: %v", err, err)
	}
}
Esempio n. 2
0
func TestFlagGet(t *testing.T) {
	v := zbase32.Value{0x34, 0x5a}
	switch b := v.Get().(type) {
	case []byte:
		if g, e := b, []byte{0x34, 0x5a}; !bytes.Equal(g, e) {
			t.Errorf("wrong Get: [% x] != [% x]", g, e)
		}
	default:
		t.Fatalf("wrong Get result: %T: %v", b, b)
	}
}
Esempio n. 3
0
func TestFlagString(t *testing.T) {
	v := zbase32.Value{0x34, 0x5a}
	if g, e := v.String(), "gtpy"; g != e {
		t.Errorf("wrong String: %q != %q", g, e)
	}
}