ops_error_logger_attribution_test.go 304 B

1234567891011121314
  1. package handler
  2. import (
  3. "testing"
  4. )
  5. func TestKeyPrefix(t *testing.T) {
  6. if got := keyPrefix("sk-3f2a9c7e", 8); got != "sk-3f2a9" {
  7. t.Errorf("keyPrefix=%q want %q", got, "sk-3f2a9")
  8. }
  9. if got := keyPrefix("abc", 8); got != "abc" {
  10. t.Errorf("short key should be returned as-is, got %q", got)
  11. }
  12. }