diff --git a/uni_modules/uts-tests/utssdk/RegExp.uts b/uni_modules/uts-tests/utssdk/RegExp.uts index 6440a003274cf1fab2ab5aa82396ea259ae7e3b5..1e2ac9ff05dc5c11da8459e872e7d99956daa37a 100644 --- a/uni_modules/uts-tests/utssdk/RegExp.uts +++ b/uni_modules/uts-tests/utssdk/RegExp.uts @@ -2,6 +2,23 @@ import { describe, test, expect, Result } from './tests.uts' export function testRegExp(): Result { return describe("RegExp", () => { + test("constructor", () => { + // #ifdef APP-ANDROID + const str = 'table football'; + const regex = new RegExp('foo*'); + const globalRegex = new RegExp(); + + expect(regex.test(str)).toEqual(true); + expect(globalRegex.test(str)).toEqual(true); + + let r2 = new RegExp(/ab+c/); + expect(r2.test(str)).toEqual(false); + + let r3 = new RegExp(/foo/); + expect(r3.test(str)).toEqual(true); + // #endif + }) + test("dotAll", () => { const regex1 = new RegExp('foo', 's'); expect(regex1.dotAll).toEqual(true); diff --git a/uni_modules/uts-tests/utssdk/String.uts b/uni_modules/uts-tests/utssdk/String.uts index 693b7e78f8ef64b766e6797f4afd1355e062938b..9c9d2f350e9f87d2300ac310f9edac18eda61357 100644 --- a/uni_modules/uts-tests/utssdk/String.uts +++ b/uni_modules/uts-tests/utssdk/String.uts @@ -56,6 +56,7 @@ export function testString(): Result { expect(empty.charAt(0)).toEqual(""); }) test('toWellFormed', () => { + // #ifdef APP-ANDROID expect("ab\uD800".toWellFormed()).toEqual("ab\uFFFD"); expect("ab\uD800c".toWellFormed()).toEqual("ab\uFFFDc"); expect("\uDFFFab".toWellFormed()).toEqual("\uFFFDab"); @@ -64,8 +65,10 @@ export function testString(): Result { expect("ab\uD83D\uDE04c".toWellFormed()).toEqual("ab\uD83D\uDE04c"); expect("ab\uD83D\uDE04c".toWellFormed()).toEqual("ab\uD83D\uDE04c"); expect("ab\uD83D\uDE04c\uD83D".toWellFormed()).toEqual("ab\uD83D\uDE04c\uFFFD"); + // #endif }) test('isWellFormed', () => { + // #ifdef APP-ANDROID expect("ab\uD800".isWellFormed()).toEqual(false); expect("ab\uD800c".isWellFormed()).toEqual(false); expect("\uDFFFab".isWellFormed()).toEqual(false); @@ -74,6 +77,7 @@ export function testString(): Result { expect("ab\uD83D\uDE04c".isWellFormed()).toEqual(true); expect("ab\uD83D\uDE04c".isWellFormed()).toEqual(true); expect("ab\uD83D\uDE04c\uD83D".isWellFormed()).toEqual(false); + // #endif }) test('charCodeAt', () => { const sentence = 'The quick brown fox jumps over the lazy dog.';