Skip to content

Commit

Permalink
Add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
marcprux committed Oct 31, 2024
1 parent 5c9b2e5 commit 344d2dd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
12 changes: 11 additions & 1 deletion Sources/AndroidBridge/AndroidBridge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,17 @@ import SkipBridge

// SKIP @BridgeToKotlin
func testSupport_isSkipMode() -> Int32 {
isSkipMode()
#if SKIP
fatalError("testSupport_isSkipMode should never be transpiled")
return -1 // this should NEVER be transpiled
#else
return isSkipMode()
#endif
}

// SKIP @BridgeToKotlin
func testSupport_getJavaSystemProperty(_ name: String) -> String? {
getJavaSystemProperty(name)
}

// SKIP @BridgeToKotlin
Expand Down
7 changes: 5 additions & 2 deletions Tests/AndroidBridgeTests/AndroidBridgeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ final class AndroidBridgeTests: XCTestCase {

func testAndroidBridge() throws {
let mode = testSupport_isSkipMode()
let tmpdir = testSupport_getJavaSystemProperty("java.io.tmpdir")
#if SKIP
XCTAssertEqual(1, mode, "@BridgeToSwift should be transpiled")
//XCTAssertEqual("/data/user/0/android.bridge.test/cache", tmpdir)
XCTAssertEqual(isRobolectric ? 0 : 1, mode, "@BridgeToSwift should be transpiled: \(mode)")
#else
XCTAssertEqual(0, mode, "@BridgeToSwift should NOT be transpiled")
//XCTAssertEqual(nil, tmpdir)
XCTAssertEqual(0, mode, "@BridgeToSwift should NOT be transpiled: \(mode)")
#endif

logger.log("running testSkipAndroidBridge")
Expand Down

0 comments on commit 344d2dd

Please sign in to comment.