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

Function TestIsCommitSHA_Integration

pkg/cli/update_integration_test.go:409–430  ·  view source on GitHub ↗

TestIsCommitSHA_Integration tests commit SHA identification with real-world examples.

(t *testing.T)

Source from the content-addressed store, hash-verified

407
408// TestIsCommitSHA_Integration tests commit SHA identification with real-world examples.
409func TestIsCommitSHA_Integration(t *testing.T) {
410 tests := []struct {
411 name string
412 ref string
413 expected bool
414 }{
415 {"real commit SHA", "6c79ed2ea350161ad5dcc9624cf510f134c6a9e3", true},
416 {"another SHA", "f43a0e5ff2bd294095638e18286ca9a3d1956744", true},
417 {"v-prefixed tag", "v1.2.3", false},
418 {"branch name", "main", false},
419 {"short SHA", "6c79ed2", false},
420 {"39 chars", "6c79ed2ea350161ad5dcc9624cf510f134c6a9e", false},
421 {"41 chars", "6c79ed2ea350161ad5dcc9624cf510f134c6a9e39", false},
422 {"non-hex 40 chars", "ghijklmnopqrstuvwxyz12345678901234567890", false},
423 }
424
425 for _, tt := range tests {
426 t.Run(tt.name, func(t *testing.T) {
427 assert.Equal(t, tt.expected, IsCommitSHA(tt.ref), "IsCommitSHA(%q)", tt.ref)
428 })
429 }
430}
431
432// --- Helper Function Tests ---
433

Callers

nothing calls this directly

Calls 2

IsCommitSHAFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected