mask_test.go 352 B

1234567891011121314151617181920
  1. package mask
  2. import "testing"
  3. func TestValue(t *testing.T) {
  4. cases := []struct {
  5. in, want string
  6. }{
  7. {"", "***"},
  8. {"a", "***"},
  9. {"abcd", "***"},
  10. {"abcde", "abcd***"},
  11. {"sk-ant-xxxxxxxxx", "sk-a***"},
  12. }
  13. for _, c := range cases {
  14. if got := Value(c.in); got != c.want {
  15. t.Errorf("Value(%q) = %q want %q", c.in, got, c.want)
  16. }
  17. }
  18. }