summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGregor Jasny <gjasny@googlemail.com>2017-03-29 13:32:01 (GMT)
committerGregor Jasny <gjasny@googlemail.com>2017-03-29 13:36:05 (GMT)
commit77139e320c8ec7f92e1298cc57fea7276faceb12 (patch)
tree8f53ae444ca21b64b7cac32a1af44c7387e376cf
parentc03141c04cededf6bf31d51627cd8b29c7668495 (diff)
downloadCMake-77139e320c8ec7f92e1298cc57fea7276faceb12.zip
CMake-77139e320c8ec7f92e1298cc57fea7276faceb12.tar.gz
CMake-77139e320c8ec7f92e1298cc57fea7276faceb12.tar.bz2
Swift: Simplify mixed test case to make it version agnostic
Issue: #16742
-rw-r--r--Tests/SwiftMix/ObjCMain.m8
-rw-r--r--Tests/SwiftMix/SwiftMain.swift15
2 files changed, 3 insertions, 20 deletions
diff --git a/Tests/SwiftMix/ObjCMain.m b/Tests/SwiftMix/ObjCMain.m
index 5a8700c..20f0bf1 100644
--- a/Tests/SwiftMix/ObjCMain.m
+++ b/Tests/SwiftMix/ObjCMain.m
@@ -1,10 +1,4 @@
#import "SwiftMix-Swift.h"
int ObjCMain(int argc, char const* const argv[]) {
- if ([SwiftMainClass respondsToSelector:@selector(SwiftMain:argv:)]) {
- return [SwiftMainClass SwiftMain:argc argv:argv];
- }
- if ([SwiftMainClass respondsToSelector:@selector(SwiftMainWithArgc:argv:)]) {
- return [SwiftMainClass SwiftMainWithArgc:argc argv:argv];
- }
- return -1;
+ return [SwiftMainClass SwiftMain];
}
diff --git a/Tests/SwiftMix/SwiftMain.swift b/Tests/SwiftMix/SwiftMain.swift
index 921439a..a4a0a62 100644
--- a/Tests/SwiftMix/SwiftMain.swift
+++ b/Tests/SwiftMix/SwiftMain.swift
@@ -1,19 +1,8 @@
import Foundation
@objc class SwiftMainClass : NSObject {
- class func SwiftMain(argc:Int, argv:UnsafePointer<UnsafePointer<CChar>>) -> Int32 {
- dump("argc: \(argc)")
-#if swift(>=3.0)
- for i in 0 ..< argc {
- let argi = String(cString:argv[i]);
- dump("arg[\(i)]: \(argi)");
- }
-#else
- for (var i = 0; i < argc; ++i) {
- let argi = String.fromCString(argv[i])
- dump("arg[\(i)]: \(argi)");
- }
-#endif
+ class func SwiftMain() -> Int32 {
+ dump("Hello World!");
return 0;
}
}