Test SetVersionInfo and GetVersion functions
(t *testing.T)
| 532 | |
| 533 | // Test SetVersionInfo and GetVersion functions |
| 534 | func 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 |
| 573 | func TestCleanupOrphanedIncludes(t *testing.T) { |
nothing calls this directly
no test coverage detected