Skip to content

Commit c57b70a

Browse files
committed
adjust Swift tests to new source generation
1 parent b3039e5 commit c57b70a

File tree

3 files changed

+6
-13
lines changed

3 files changed

+6
-13
lines changed

Sources/JExtractSwift/Swift2JavaTranslator+Printing.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,6 @@ extension Swift2JavaTranslator {
252252
}
253253

254254
public func printHeader(_ printer: inout CodePrinter) {
255-
assert(printer.isEmpty)
256255
printer.print(
257256
"""
258257
// Generated by jextract-swift

Tests/JExtractSwiftTests/MethodImportTests.swift

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ final class MethodImportTests {
3838
public func globalTakeIntLongString(i32: Int32, l: Int64, s: String)
3939
4040
extension MySwiftClass {
41-
// MANGLED NAME: $s14MySwiftLibrary0aB5ClassC22helloMemberFunctionInExtension
4241
public func helloMemberInExtension()
4342
}
4443
@@ -54,12 +53,6 @@ final class MethodImportTests {
5453
5554
@objc deinit
5655
}
57-
58-
// FIXME: Hack to allow us to translate "String", even though it's not
59-
// actually available
60-
// MANGLED NAME: $ss
61-
public class String {
62-
}
6356
"""
6457

6558
@Test("Import: public func helloWorld()")
@@ -174,13 +167,14 @@ final class MethodImportTests {
174167
* public func globalTakeIntLongString(i32: Int32, l: Int64, s: String)
175168
* }
176169
*/
177-
public static void globalTakeIntLongString(int i32, long l, com.example.swift.String s) {
170+
public static void globalTakeIntLongString(int i32, long l, java.lang.String s) {
178171
var mh$ = globalTakeIntLongString.HANDLE;
179-
try {
172+
try (var arena = Arena.ofConfined()) {
173+
var s$ = arena.allocateFrom(s);
180174
if (SwiftKit.TRACE_DOWNCALLS) {
181-
SwiftKit.traceDowncall(i32, l, s.$memorySegment());
175+
SwiftKit.traceDowncall(i32, l, s$);
182176
}
183-
mh$.invokeExact(i32, l, s.$memorySegment());
177+
mh$.invokeExact(i32, l, s$);
184178
} catch (Throwable ex$) {
185179
throw new AssertionError("should not reach here", ex$);
186180
}

Tests/JExtractSwiftTests/StringPassingTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ final class StringPassingTests {
4242
try (var arena = Arena.ofConfined()) {
4343
var string$ = arena.allocateFrom(string);
4444
if (SwiftKit.TRACE_DOWNCALLS) {
45-
SwiftKit.traceDowncall();
45+
SwiftKit.traceDowncall(string$);
4646
}
4747
return (long) mh$.invokeExact(string$);
4848
} catch (Throwable ex$) {

0 commit comments

Comments
 (0)