fee4f6dd31
Hop-State: A_06FN6MRSHG4B64ZV13086G8 Hop-Proposal: R_06FN6MQDE14FFNR65H1D28G Hop-Task: T_06FN6J8ECE1Z9XQ5PQ3Z3D8 Hop-Attempt: AT_06FN6J8ECC1SC794JMZ0TF8
34 lines
574 B
Go
34 lines
574 B
Go
package ids
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestRepository(t *testing.T) {
|
|
first, err := Repository()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
second, err := Repository()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if !strings.HasPrefix(first, "RP_") || len(first) != 29 {
|
|
t.Fatalf("unexpected repository ID %q", first)
|
|
}
|
|
if first == second {
|
|
t.Fatal("generated duplicate IDs")
|
|
}
|
|
}
|
|
|
|
func TestPrompt(t *testing.T) {
|
|
id, err := Prompt()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if !strings.HasPrefix(id, "PM_") || len(id) != 29 {
|
|
t.Fatalf("unexpected prompt ID %q", id)
|
|
}
|
|
}
|