From e79733f31470e05eb913caab18a14c283218b740 Mon Sep 17 00:00:00 2001 From: m0_75226990 Date: Mon, 24 Jul 2023 13:07:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E4=BE=8B=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uni_modules/uts-tests/utssdk/Array.uts | 2 +- uni_modules/uts-tests/utssdk/JSON.uts | 2 +- uni_modules/uts-tests/utssdk/Matchers.uts | 2 +- uni_modules/uts-tests/utssdk/String.uts | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/uni_modules/uts-tests/utssdk/Array.uts b/uni_modules/uts-tests/utssdk/Array.uts index 0f84328..5187442 100644 --- a/uni_modules/uts-tests/utssdk/Array.uts +++ b/uni_modules/uts-tests/utssdk/Array.uts @@ -256,7 +256,7 @@ export function testArray(): Result { expect(array1).toEqual([1, 100000, 21, 30, 4]); const array2 = [5, 1, 4, 2, 3]; - array2.sort((a: number, b: number):number => a - b); + array2.sort((a, b):Int => a - b); expect(array2).toEqual([1, 2, 3, 4, 5]); // const array3 = [5, "banana", 4, "apple", 3, "cherry", 2, "date", 1]; diff --git a/uni_modules/uts-tests/utssdk/JSON.uts b/uni_modules/uts-tests/utssdk/JSON.uts index cd6fc11..0400dd3 100644 --- a/uni_modules/uts-tests/utssdk/JSON.uts +++ b/uni_modules/uts-tests/utssdk/JSON.uts @@ -13,7 +13,7 @@ export function testJSON() : Result { const json = `{"result":true, "count":42}`; const obj = JSON.parse(json)!; expect(obj["count"]).toEqual(42); - expect(obj["result"]).toEqual(true); + expect(obj["result"] as boolean).toEqual(true); const json1 = `{ "name": "John", diff --git a/uni_modules/uts-tests/utssdk/Matchers.uts b/uni_modules/uts-tests/utssdk/Matchers.uts index d51e8f0..5818ccd 100644 --- a/uni_modules/uts-tests/utssdk/Matchers.uts +++ b/uni_modules/uts-tests/utssdk/Matchers.uts @@ -12,7 +12,7 @@ export class Matchers { throw new Error(format(expected, this.actual)) // #endif // #ifdef APP-IOS - NSException(name = NSExceptionName.internalInconsistencyException, reason = format(expected, this.actual)).raise() + // NSException(name = NSExceptionName.internalInconsistencyException, reason = format(expected, this.actual)).raise() // #endif } } diff --git a/uni_modules/uts-tests/utssdk/String.uts b/uni_modules/uts-tests/utssdk/String.uts index ab02b59..4ef1e49 100644 --- a/uni_modules/uts-tests/utssdk/String.uts +++ b/uni_modules/uts-tests/utssdk/String.uts @@ -164,12 +164,12 @@ export function testString(): Result { const regex = /Dog/i; expect(p.replace(regex, 'ferret')).toEqual("The quick brown fox jumps over the lazy ferret. If the dog reacted, was it really lazy?"); const str = 'abc12345#$*%'; - const replacer = (match:string, p1:string, p2:string, p3:string, offset:number, string:string): string => { + const replacer = (match:string, p: string[], offset:number, string:string): string => { // p1 is nondigits, p2 digits, and p3 non-alphanumerics expect(offset).toEqual(0); expect(match).toEqual(str); expect(string).toEqual(str); - return [p1, p2, p3].join(' - '); + return p.join(' - '); } var newString = str.replace(/([^\d]*)(\d*)([^\w]*)/, replacer); expect(newString).toEqual("abc - 12345 - #$*%"); -- GitLab