You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

templates_test.go 427B

12345678910111213141516
  1. package httplistener
  2. import "testing"
  3. func TestTemplates(t *testing.T) {
  4. test_refName(t, "refs/heads/main", "main")
  5. test_refName(t, "refs/tags/v1.2.3", "v1.2.3")
  6. test_refName(t, "refs/heads/feature/123-abc", "feature/123-abc")
  7. }
  8. func test_refName(t *testing.T, ref string, expected string) {
  9. got := refName(ref)
  10. if got != expected {
  11. t.Fatalf("Expected ref %q to be prettified to %q, got %q", ref, expected, got)
  12. }
  13. }