Files
jeffryandClaude Opus 5.5 dde7183528 Rename loom → norn
The project is now norn: .loom/ is .norn/, loomctl is nornctl
(NORNCTL_* env vars, ~/.config/nornctl), and the Gitea org is norn.
Event logs moved with the directory but their text is unchanged —
they are a record of what was decided at the time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-06 11:06:49 -05:00

35 lines
1.4 KiB
Go

package external
import "testing"
func TestSplitRemote(t *testing.T) {
for _, tc := range []struct {
remote, host, ownerRepo string
ok bool
}{
{"ssh://git@git.hypertheory-labs.dev:2222/norn/norn-cli.git", "git.hypertheory-labs.dev", "norn/norn-cli", true},
{"ssh://git@git.hypertheory-labs.dev/norn/norn-cli.git", "git.hypertheory-labs.dev", "norn/norn-cli", true},
{"git@github.com:octocat/Hello-World.git", "github.com", "octocat/Hello-World", true},
{"https://gitlab.com/gitlab-org/gitlab-svgs.git", "gitlab.com", "gitlab-org/gitlab-svgs", true},
{"https://gitlab.com/gitlab-org/gitlab-svgs", "gitlab.com", "gitlab-org/gitlab-svgs", true},
// A nested group is not owner/repo, and guessing would produce a URL
// that answers about the wrong repository.
{"https://gitlab.com/group/sub/project.git", "", "", false},
{"/srv/git/bare.git", "", "", false},
{"", "", "", false},
} {
host, or, ok := splitRemote(tc.remote)
if ok != tc.ok || host != tc.host || or != tc.ownerRepo {
t.Errorf("splitRemote(%q) = (%q, %q, %v), want (%q, %q, %v)",
tc.remote, host, or, ok, tc.host, tc.ownerRepo, tc.ok)
}
}
}
func TestSelfVisibilityUnknownOutsideARepo(t *testing.T) {
// Failing open matters: "cannot tell" must not read as "not public".
if _, known := selfVisibility(t.TempDir()); known {
t.Error("selfVisibility in a non-repository reported a known answer")
}
}