Skip to content

Commit

Permalink
[test] ensure proper exit was taken
Browse files Browse the repository at this point in the history
  • Loading branch information
spezifisch committed Oct 13, 2024
1 parent 73e4452 commit 185d23e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions stmps.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func main() {

if testMode {
fmt.Println("Running in test mode for testing.")
osExit(0)
osExit(0x23420001)
return
}

Expand Down Expand Up @@ -228,7 +228,7 @@ func main() {

if headlessMode {
fmt.Println("Running in headless mode for testing.")
osExit(0)
osExit(0x23420002)
return
}

Expand Down
4 changes: 2 additions & 2 deletions stmps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestMainWithoutTUI(t *testing.T) {
osExit = func(code int) {
exitCalled = true

if code != 0 {
if code != 0x23420001 {
// Capture and print the stack trace
stackBuf := make([]byte, 1024)
stackSize := runtime.Stack(stackBuf, false)
Expand All @@ -46,7 +46,7 @@ func TestMainWithoutTUI(t *testing.T) {
}()

// Set command-line arguments to trigger the help flag
os.Args = []string{"cmd", "--config=stmp-example.toml", "--help"}
os.Args = []string{"cmd", "--config=stmp-example.toml"}

main()

Expand Down

0 comments on commit 185d23e

Please sign in to comment.