move out c/cpp/py

This commit is contained in:
Li Jie
2025-04-03 15:52:18 +08:00
parent 0a8a4eb6a6
commit ed366568b4
777 changed files with 4608 additions and 139122 deletions

View File

@@ -0,0 +1,29 @@
package mockable
import (
"os"
)
var (
exitFunc = os.Exit
exitCode int
)
// EnableMock enables mocking of os.Exit
func EnableMock() {
exitCode = 0
exitFunc = func(code int) {
exitCode = code
panic("exit")
}
}
// Exit calls the current exit function
func Exit(code int) {
exitFunc(code)
}
// ExitCode returns the last exit code from a mocked Exit call
func ExitCode() int {
return exitCode
}