Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CMake
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
André Pedro
CMake
Commits
77139e32
Commit
77139e32
authored
7 years ago
by
Gregor Jasny
Browse files
Options
Downloads
Patches
Plain Diff
Swift: Simplify mixed test case to make it version agnostic
Issue: #16742
parent
c03141c0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Tests/SwiftMix/ObjCMain.m
+1
-7
1 addition, 7 deletions
Tests/SwiftMix/ObjCMain.m
Tests/SwiftMix/SwiftMain.swift
+2
-13
2 additions, 13 deletions
Tests/SwiftMix/SwiftMain.swift
with
3 additions
and
20 deletions
Tests/SwiftMix/ObjCMain.m
+
1
−
7
View file @
77139e32
#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];
}
This diff is collapsed.
Click to expand it.
Tests/SwiftMix/SwiftMain.swift
+
2
−
13
View file @
77139e32
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
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment