File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,6 +30,6 @@ enum JNICaching {
3030 }
3131
3232 static func cacheMemberName( for translatedEnumCase: JNISwift2JavaGenerator . TranslatedEnumCase ) -> String {
33- cacheMemberName ( for: translatedEnumCase. original)
33+ cacheMemberName ( for: translatedEnumCase. original)
3434 }
3535}
Original file line number Diff line number Diff line change @@ -305,6 +305,12 @@ struct JNIEnumTests {
305305 . swift,
306306 detectChunkByInitialLines: 1 ,
307307 expectedChunks: [
308+ """
309+ enum _JNI_MyEnum {
310+ static let myEnumSecondCache = _JNIMethodIDCache(className: " com/example/swift/MyEnum$Second$_NativeParameters " , methods: [.init(name: " <init> " , signature: " (Ljava/lang/String;)V " )])
311+ static let myEnumThirdCache = _JNIMethodIDCache(className: " com/example/swift/MyEnum$Third$_NativeParameters " , methods: [.init(name: " <init> " , signature: " (JI)V " )])
312+ }
313+ """ ,
308314 """
309315 @_cdecl( " Java_com_example_swift_MyEnum__00024getAsSecond__J " )
310316 public func Java_com_example_swift_MyEnum__00024getAsSecond__J(environment: UnsafeMutablePointer<JNIEnv?>!, thisClass: jclass, selfPointer: jlong) -> jobject? {
@@ -335,6 +341,36 @@ struct JNIEnumTests {
335341 return environment.interface.NewObjectA(environment, class$, constructorID$, newObjectArgs$)
336342 }
337343 """ ,
344+ ] ,
345+ notExpectedChunks: [
346+ " public func Java_com_example_swift_MyEnum__00024getAsFirst__J( "
347+ ]
348+ )
349+ }
350+
351+ @Test
352+ func nonGeneratesGetAsCase_swift( ) throws {
353+ try assertOutput (
354+ input: """
355+ public enum MyEnum {
356+ case first
357+ case second
358+ }
359+ """ ,
360+ . jni,
361+ . swift,
362+ detectChunkByInitialLines: 1 ,
363+ expectedChunks: [ ] ,
364+ notExpectedChunks: [
365+ """
366+ enum _JNI_MyEnum
367+ """ ,
368+ """
369+ public func Java_com_example_swift_MyEnum__00024getAsFirst__J( "
370+ """ ,
371+ """
372+ public func Java_com_example_swift_MyEnum__00024getAsSecond__J(
373+ """ ,
338374 ]
339375 )
340376 }
You can’t perform that action at this time.
0 commit comments