Files
swift-mirror/validation-test/StdlibUnittest/CommandLine.swift
Jordan Rose 40f57149f6 Move StdlibUnittest tests to their own directory.
StdlibUnittest.swift became StdlibUnittest/Common.swift;
all others just dropped the "StdlibUnittest" prefix.
2016-03-18 16:19:30 -07: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: {{^}}stdout>>> ["{{[^"]+}}", "--stdlib-unittest-run-child"]{{$}}
// CHECK-1: {{^}}stdout>>> ["{{[^"]+}}", "--stdlib-unittest-run-child", "--abc"]{{$}}
// CHECK-2: {{^}}stdout>>> ["{{[^"]+}}", "--stdlib-unittest-run-child", "--abc", "def"]{{$}}
// CHECK-3: {{^}}stdout>>> ["{{[^"]+}}", "--stdlib-unittest-run-child", "a", "--bcd", "efghijk"]{{$}}
runAllTests()