-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Disable fatal tests on macOS
- Loading branch information
Showing
4 changed files
with
70 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
//go:build !darwin | ||
// +build !darwin | ||
|
||
// This test should currently really not run on macOS, because it might | ||
// lead to crashes. | ||
|
||
package interceptor | ||
|
||
import ( | ||
"os" | ||
"os/exec" | ||
"testing" | ||
|
||
"github.com/echocat/slf4g/internal/test/assert" | ||
) | ||
|
||
func Test_fatalExit(t *testing.T) { | ||
if os.Getenv("DO_IT_NOW_REALLY") == "1" { | ||
fatalExit(66) | ||
return | ||
} | ||
|
||
cmd := exec.Command(os.Args[0], "-test.run="+t.Name()) | ||
cmd.Env = append(os.Environ(), "DO_IT_NOW_REALLY=1") | ||
err := cmd.Run() | ||
if e, ok := err.(*exec.ExitError); ok { | ||
if e.ExitCode() != 66 { | ||
assert.Failf(t, "Expected to fail with exit code <1>; bot got error: <%+v>", e.ExitCode()) | ||
} | ||
} else if err != nil { | ||
assert.Failf(t, "Expected to fail with exit code <1>; bot got error: <%+v>", err) | ||
} else { | ||
assert.Fail(t, "Expected to fail with exit code <1>; bot it exists with 0.") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
//go:build !darwin | ||
// +build !darwin | ||
|
||
// This test should currently really not run on macOS, because it might | ||
// lead to crashes. | ||
|
||
package sdk | ||
|
||
import ( | ||
"os" | ||
"os/exec" | ||
"testing" | ||
|
||
"github.com/echocat/slf4g/internal/test/assert" | ||
) | ||
|
||
func Test_DefaultOnFatal(t *testing.T) { | ||
if os.Getenv("DO_IT_NOW_REALLY") == "1" { | ||
DefaultOnFatal(nil) | ||
return | ||
} | ||
|
||
cmd := exec.Command(os.Args[0], "-test.run="+t.Name()) | ||
cmd.Env = append(os.Environ(), "DO_IT_NOW_REALLY=1") | ||
err := cmd.Run() | ||
if e, ok := err.(*exec.ExitError); ok { | ||
if e.ExitCode() != 1 { | ||
assert.Failf(t, "Expected to fail with exit code <1>; bot got error: <%+v>", e.ExitCode()) | ||
} | ||
} else if err != nil { | ||
assert.Failf(t, "Expected to fail with exit code <1>; bot got error: <%+v>", err) | ||
} else { | ||
assert.Fail(t, "Expected to fail with exit code <1>; bot it exists with 0.") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters