Files
swift-mirror/validation-test/stdlib/StdlibUnittestCommandLine.swift
Dmitri Gribenko 9b15d03b73 StdlibUnittest: don't pass the name of the executable on the command line
Also, add a test for the command line of the child process.
2015-12-24 02:27:57 -08:00

29 lines
1.2 KiB
Swift

// RUN: rm -rf %t && mkdir %t
// RUN: %target-build-swift %s -o %t/main.out
// RUN: %target-run %t/main.out | FileCheck -check-prefix=CHECK-EMPTY %s
// RUN: %target-run %t/main.out --abc | FileCheck -check-prefix=CHECK-1 %s
// RUN: %target-run %t/main.out --abc def | FileCheck -check-prefix=CHECK-2 %s
// RUN: %target-run %t/main.out a --bcd efghijk | FileCheck -check-prefix=CHECK-3 %s
// REQUIRES: executable_test
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
#if _runtime(_ObjC)
import ObjectiveC
#endif
var CommandLineArguments = TestSuite("CommandLineArguments")
CommandLineArguments.test("printCommandLineArguments") {
debugPrint(Process.arguments)
}
// CHECK-EMPTY: {{^}}out>>> ["{{[^"]+}}", "--stdlib-unittest-run-child"]{{$}}
// CHECK-1: {{^}}out>>> ["{{[^"]+}}", "--stdlib-unittest-run-child", "--abc"]{{$}}
// CHECK-2: {{^}}out>>> ["{{[^"]+}}", "--stdlib-unittest-run-child", "--abc", "def"]{{$}}
// CHECK-3: {{^}}out>>> ["{{[^"]+}}", "--stdlib-unittest-run-child", "a", "--bcd", "efghijk"]{{$}}
runAllTests()