MCPcopy Create free account
hub / github.com/github/gh-aw / TestIsBranchRef

Function TestIsBranchRef

pkg/cli/update_command_test.go:1016–1036  ·  view source on GitHub ↗

TestIsBranchRef tests the isBranchRef helper that distinguishes branch names from semantic version tags and commit SHAs

(t *testing.T)

Source from the content-addressed store, hash-verified

1014// TestIsBranchRef tests the isBranchRef helper that distinguishes branch names
1015// from semantic version tags and commit SHAs
1016func TestIsBranchRef(t *testing.T) {
1017 tests := []struct {
1018 name string
1019 ref string
1020 expected bool
1021 }{
1022 {"branch main", "main", true},
1023 {"branch develop", "develop", true},
1024 {"branch with slash", "feature/foo", true},
1025 {"semver tag", "v1.2.3", false},
1026 {"semver tag with v", "v0.1.0", false},
1027 {"commit SHA", "ea350161ad5dcc9624cf510f134c6a9e39a6f94d", false},
1028 }
1029
1030 for _, tt := range tests {
1031 t.Run(tt.name, func(t *testing.T) {
1032 result := isBranchRef(tt.ref)
1033 assert.Equal(t, tt.expected, result, "isBranchRef(%q) should return %v", tt.ref, tt.expected)
1034 })
1035 }
1036}
1037
1038// TestRunUpdateWorkflows_NoSourceWorkflows tests that RunUpdateWorkflows reports a message (not an error) when no source workflows exist
1039func TestRunUpdateWorkflows_NoSourceWorkflows(t *testing.T) {

Callers

nothing calls this directly

Calls 2

isBranchRefFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected