Skip to content

Commit 7878391

Browse files
committed
update tests
1 parent 4111f62 commit 7878391

File tree

1 file changed

+11
-20
lines changed

1 file changed

+11
-20
lines changed

Tests/JExtractSwiftTests/JNI/JNIVariablesTests.swift

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,7 @@ struct JNIVariablesTests {
421421
* }
422422
*/
423423
public boolean isBoolean() {
424-
long self$ = this.$memoryAddress();
425-
return MyClass.$isBoolean(self$);
424+
return MyClass.$isBoolean(this.$memoryAddress());
426425
}
427426
""",
428427
"""
@@ -433,15 +432,14 @@ struct JNIVariablesTests {
433432
* }
434433
*/
435434
public void setBoolean(boolean newValue) {
436-
long self$ = this.$memoryAddress();
437-
MyClass.$setBoolean(newValue, self$);
435+
MyClass.$setBoolean(newValue, this.$memoryAddress());
438436
}
439437
""",
440438
"""
441-
private static native boolean $isBoolean(long selfPointer);
439+
private static native boolean $isBoolean(long self);
442440
""",
443441
"""
444-
private static native void $setBoolean(boolean newValue, long selfPointer);
442+
private static native void $setBoolean(boolean newValue, long self);
445443
"""
446444
]
447445
)
@@ -457,27 +455,20 @@ struct JNIVariablesTests {
457455
expectedChunks: [
458456
"""
459457
@_cdecl("Java_com_example_swift_MyClass__00024isBoolean__J")
460-
func Java_com_example_swift_MyClass__00024isBoolean__J(environment: UnsafeMutablePointer<JNIEnv?>!, thisClass: jclass, selfPointer: jlong) -> jboolean {
461-
guard let env$ = environment else {
462-
fatalError("Missing JNIEnv in downcall to \\(#function)")
463-
}
464-
assert(selfPointer != 0, "selfPointer memory address was null")
465-
let selfBits$ = Int(Int64(fromJNI: selfPointer, in: env$))
458+
func Java_com_example_swift_MyClass__00024isBoolean__J(environment: UnsafeMutablePointer<JNIEnv?>!, thisClass: jclass, self: jlong) -> jboolean {
459+
assert(self != 0, "self memory address was null")
460+
let selfBits$ = Int(Int64(fromJNI: self, in: environment!))
466461
guard let self$ = UnsafeMutablePointer<MyClass>(bitPattern: selfBits$) else {
467462
fatalError("self memory address was null in call to \\(#function)!")
468463
}
469-
let result = self$.pointee.isBoolean
470-
return result.getJNIValue(in: environment)
464+
return self$.pointee.isBoolean.getJNIValue(in: environment!)
471465
}
472466
""",
473467
"""
474468
@_cdecl("Java_com_example_swift_MyClass__00024setBoolean__ZJ")
475-
func Java_com_example_swift_MyClass__00024setBoolean__ZJ(environment: UnsafeMutablePointer<JNIEnv?>!, thisClass: jclass, newValue: jboolean, selfPointer: jlong) {
476-
guard let env$ = environment else {
477-
fatalError("Missing JNIEnv in downcall to \\(#function)")
478-
}
479-
assert(selfPointer != 0, "selfPointer memory address was null")
480-
let selfBits$ = Int(Int64(fromJNI: selfPointer, in: env$))
469+
func Java_com_example_swift_MyClass__00024setBoolean__ZJ(environment: UnsafeMutablePointer<JNIEnv?>!, thisClass: jclass, newValue: jboolean, self: jlong) {
470+
assert(self != 0, "self memory address was null")
471+
let selfBits$ = Int(Int64(fromJNI: self, in: environment!))
481472
guard let self$ = UnsafeMutablePointer<MyClass>(bitPattern: selfBits$) else {
482473
fatalError("self memory address was null in call to \\(#function)!")
483474
}

0 commit comments

Comments
 (0)