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

Function TestSetVersionInfo

pkg/cli/commands_test.go:534–570  ·  view source on GitHub ↗

Test SetVersionInfo and GetVersion functions

(t *testing.T)

Source from the content-addressed store, hash-verified

532
533// Test SetVersionInfo and GetVersion functions
534func TestSetVersionInfo(t *testing.T) {
535 // Save original version to restore after test
536 originalVersion := GetVersion()
537 defer SetVersionInfo(originalVersion)
538
539 tests := []struct {
540 name string
541 version string
542 }{
543 {
544 name: "normal version",
545 version: "1.0.0",
546 },
547 {
548 name: "empty version",
549 version: "",
550 },
551 {
552 name: "version with pre-release",
553 version: "2.0.0-beta.1",
554 },
555 {
556 name: "version with build metadata",
557 version: "1.2.3+20240808",
558 },
559 }
560
561 for _, tt := range tests {
562 t.Run(tt.name, func(t *testing.T) {
563 SetVersionInfo(tt.version)
564 got := GetVersion()
565 if got != tt.version {
566 t.Errorf("SetVersionInfo(%q) -> GetVersion() = %q, want %q", tt.version, got, tt.version)
567 }
568 })
569 }
570}
571
572// TestCleanupOrphanedIncludes tests that root workflow files are not removed as "orphaned" includes
573func TestCleanupOrphanedIncludes(t *testing.T) {

Callers

nothing calls this directly

Calls 4

SetVersionInfoFunction · 0.85
GetVersionFunction · 0.70
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected