Files
swift-mirror/validation-test/Evolution/test_rth.swift
Saleem Abdulrasool 9e901eb0f8 test: fix the path separator for Evolution.test_rth
Windows uses `\` for the path separator while other targets use `/`
Use the correct seprator for calculating the basename of the executable
to enable the test on Windows.
2019-06-12 13:48:08 -07:00

40 lines
800 B
Swift

// RUN: %target-resilience-test
// REQUIRES: executable_test
// Check for the 'rth' tool itself, to make sure it's doing what we expect.
import rth
#if BEFORE
let clientIsAfter = false
#else
let clientIsAfter = true
#endif
let execPath = CommandLine.arguments.first!
#if os(Windows)
let execName = execPath.split(separator: "\\").last!
#else
let execName = execPath.split(separator: "/").last!
#endif
switch execName {
case "after_after":
precondition(clientIsAfter)
precondition(libIsAfter)
case "before_after":
precondition(clientIsAfter)
precondition(!libIsAfter)
case "before_before":
precondition(!clientIsAfter)
precondition(!libIsAfter)
case "after_before":
precondition(!clientIsAfter)
precondition(libIsAfter)
default:
fatalError("unknown exec name \(execName)")
}