diff --git a/uni_modules/uts-tests/utssdk/NativeCode.uts b/uni_modules/uts-tests/utssdk/NativeCode.uts new file mode 100644 index 0000000000000000000000000000000000000000..ed5f5f66a224c8c1c496ef71e492d848f31d756c --- /dev/null +++ b/uni_modules/uts-tests/utssdk/NativeCode.uts @@ -0,0 +1,11 @@ +import { describe, test, expect, Result } from './tests.uts' + +export function testNativeCode(): Result { + return describe("mix-native-code-work", () => { + test('getStrFromNativeCode', () => { + // #ifdef APP-ANDROID + expect(NativeCode.getNativeStr()).toEqual("android-code"); + // #endif + }) + }) +} diff --git a/uni_modules/uts-tests/utssdk/app-android/kotlinCode.kt b/uni_modules/uts-tests/utssdk/app-android/kotlinCode.kt new file mode 100644 index 0000000000000000000000000000000000000000..e10460a9d8169dd775801fb80c2a0aadbf54d4c7 --- /dev/null +++ b/uni_modules/uts-tests/utssdk/app-android/kotlinCode.kt @@ -0,0 +1,13 @@ +package uts.sdk.modules.utsTests + +import android.os.Build +import io.dcloud.uts.UTSAndroid + + +object NativeCode { + + fun getNativeStr():String{ + return "android-code" + } + +} \ No newline at end of file diff --git a/uni_modules/uts-tests/utssdk/index.uts b/uni_modules/uts-tests/utssdk/index.uts index ab5295ac534cc4ef4d30d512d68855f08f209236..d87f3b29929baa2b500d93aa052d3b687d948532 100644 --- a/uni_modules/uts-tests/utssdk/index.uts +++ b/uni_modules/uts-tests/utssdk/index.uts @@ -18,6 +18,7 @@ import { testGlobal } from './Global.uts' import { testType } from './Type.uts' export { Result } from './tests.uts' import { testArrayBuffer } from './ArrayBuffer.uts' +import { testNativeCode } from './NativeCode.uts' // Promise、Proxy、Reflect、Weakmap、WeakSet 不支持 @@ -40,7 +41,8 @@ export function runTests() : UTSJSONObject { const JSONLargeRes = testJSONLarge(); const consoleRes = testConsole(); const UTSJSONObjectRes = testUTSJSONObject(); - const ArrayBufferRes = testArrayBuffer(); + const ArrayBufferRes = testArrayBuffer(); + const NativeCodeRes = testNativeCode(); return { Array: ArrayRes, Date: DateRes, @@ -60,6 +62,7 @@ export function runTests() : UTSJSONObject { Type: TypeRes, console:consoleRes, UTSJSONObject:UTSJSONObjectRes, - ArrayBuffer:ArrayBufferRes + ArrayBuffer:ArrayBufferRes, + NativeCode:NativeCodeRes } } \ No newline at end of file