From 10d260fea47a055f4891789f4ece7837df80605e Mon Sep 17 00:00:00 2001 From: duqingquan Date: Tue, 6 Aug 2024 15:54:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0Array=20=E4=B8=8E=E5=8E=9F?= =?UTF-8?q?=E7=94=9F=E7=B1=BB=E5=9E=8B=E8=BD=AC=E6=8D=A2=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uni_modules/uts-tests/utssdk/Array.uts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/uni_modules/uts-tests/utssdk/Array.uts b/uni_modules/uts-tests/utssdk/Array.uts index f084e3c..6e13bd5 100644 --- a/uni_modules/uts-tests/utssdk/Array.uts +++ b/uni_modules/uts-tests/utssdk/Array.uts @@ -42,6 +42,20 @@ export function testArray(): Result { }) + test('convert-native', () => { + // #ifndef APP-ANDROID + let utsArray = ["1",2,3.0] + let javaArray = utsArray.toTypedArray(); + let kotlinArray = utsArray.toKotlinList() + + let convertArrayFromJava = Array.fromNative(javaArray); + let convertArrayFromKotlin = Array.fromNative(kotlinArray); + expect(convertArrayFromJava[0] == convertArrayFromKotlin[0]).toEqual(true); + expect(convertArrayFromJava[0]).toEqual("1"); + // #endif + + }) + test('length', () => { const arr = ['shoes', 'shirts', 'socks', 'sweaters']; expect(arr.length).toEqual(4); -- GitLab