mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
44 lines
922 B
Swift
44 lines
922 B
Swift
// RUN: %target-run-simple-swift
|
|
// REQUIRES: executable_test
|
|
|
|
import StdlibUnittest
|
|
#if canImport(Darwin)
|
|
import Darwin
|
|
#elseif canImport(Glibc)
|
|
import Glibc
|
|
#elseif os(Windows)
|
|
import MSVCRT
|
|
#elseif canImport(Android)
|
|
import Android
|
|
#else
|
|
#error("Unsupported platform")
|
|
#endif
|
|
|
|
//
|
|
// Test that a test runs in its own child process if asked.
|
|
//
|
|
|
|
enum Globals {
|
|
static var modifiedByChildProcess = false
|
|
}
|
|
|
|
var TestSuiteRequireNewProcess = TestSuite("TestSuiteRequireNewProcess")
|
|
|
|
TestSuiteRequireNewProcess.test("RequireOwnProcessBefore")
|
|
.code {
|
|
Globals.modifiedByChildProcess = true
|
|
}
|
|
|
|
TestSuiteRequireNewProcess.test("RequireOwnProcess")
|
|
.requireOwnProcess()
|
|
.code {
|
|
expectEqual(false, Globals.modifiedByChildProcess)
|
|
Globals.modifiedByChildProcess = true
|
|
}
|
|
|
|
TestSuiteRequireNewProcess.test("ShouldNotReusePreviousProcess") {
|
|
expectEqual(false, Globals.modifiedByChildProcess)
|
|
}
|
|
|
|
runAllTests()
|