@@ -4,36 +4,38 @@ import (
44 "testing"
55)
66
7+ var testInfo = BuildInfo {Version : "1.2.3" , Commit : "abc123" , Date : "2025-01-01" }
8+
79func TestRunVersion (t * testing.T ) {
8- exit := Run ("1.2.3" , []string {"--version" })
10+ exit := Run (testInfo , []string {"--version" })
911 if exit != 0 {
1012 t .Errorf ("expected exit code 0, got %d" , exit )
1113 }
1214}
1315
1416func TestRunVersionSubcommand (t * testing.T ) {
15- exit := Run ("1.2.3" , []string {"version" })
17+ exit := Run (testInfo , []string {"version" })
1618 if exit != 0 {
1719 t .Errorf ("expected exit code 0, got %d" , exit )
1820 }
1921}
2022
2123func TestRunHelp (t * testing.T ) {
22- exit := Run ("1.2.3" , []string {"help" })
24+ exit := Run (testInfo , []string {"help" })
2325 if exit != 0 {
2426 t .Errorf ("expected exit code 0, got %d" , exit )
2527 }
2628}
2729
2830func TestRunNoArgs (t * testing.T ) {
29- exit := Run ("1.2.3" , []string {})
31+ exit := Run (testInfo , []string {})
3032 if exit != 0 {
3133 t .Errorf ("expected exit code 0, got %d" , exit )
3234 }
3335}
3436
3537func TestRunUnknownCommand (t * testing.T ) {
36- exit := Run ("1.2.3" , []string {"unknown-command" })
38+ exit := Run (testInfo , []string {"unknown-command" })
3739 if exit != 1 {
3840 t .Errorf ("expected exit code 1, got %d" , exit )
3941 }
@@ -47,7 +49,7 @@ func TestRegisterAndRun(t *testing.T) {
4749 delete (registry , "test-cmd" )
4850 }()
4951
50- exit := Run ("1.2.3" , []string {"test-cmd" })
52+ exit := Run (testInfo , []string {"test-cmd" })
5153 if exit != 0 {
5254 t .Errorf ("expected exit code 0, got %d" , exit )
5355 }
0 commit comments