diff --git a/compileruntime/url_lib_standard/src/main/js/test/url.test.js b/compileruntime/url_lib_standard/src/main/js/test/url.test.js index 60a14751d035537183e2facbc8382052c7548fd9..486fe9161140277de2f75323cbcfd7ab23852500 100644 --- a/compileruntime/url_lib_standard/src/main/js/test/url.test.js +++ b/compileruntime/url_lib_standard/src/main/js/test/url.test.js @@ -172,7 +172,7 @@ describe('UrlFunTest', function () { i++; arr[i]=pair[1]; i++; - }; + } expect(arr[1]).assertEqual("value1"); }) @@ -268,7 +268,7 @@ describe('UrlFunTest', function () { { arr[i] = value + " " + key + " " + (params === SearchParams) i++ - }; + } params.forEach(func); expect(arr[0]).assertEqual("value1 key1 true"); }) @@ -287,7 +287,7 @@ describe('UrlFunTest', function () { { arr[i] = value + " " + key + " " + (params === SearchParams) i++ - }; + } params.forEach(func); expect(arr[1]).assertEqual("value2 key2 true"); }) @@ -307,7 +307,7 @@ describe('UrlFunTest', function () { { arr[i] = value + " " + key + " " + (params === SearchParams) i++ - }; + } params.forEach(func); expect(arr[2]).assertEqual("jk foo true"); }) @@ -326,7 +326,7 @@ describe('UrlFunTest', function () { { arr[i] = value + " " + key + " " + (params === SearchParams) i++ - }; + } params.forEach(func); expect(arr[1]).assertEqual("txt jss true"); }) @@ -346,7 +346,7 @@ describe('UrlFunTest', function () { { arr[i] = value + " " + key + " " + (params === SearchParams) i++ - }; + } params.forEach(func); expect(arr[0]).assertEqual("bar foo true"); }) @@ -553,7 +553,7 @@ describe('UrlFunTest', function () { for(var key of params.keys()) { arr[i] = key i++ - }; + } expect(arr[0]).assertEqual("小"); }) @@ -570,7 +570,7 @@ describe('UrlFunTest', function () { for(var key of params.keys()) { arr[i] = key i++ - }; + } expect(arr[1]).assertEqual("¥"); }) @@ -587,7 +587,7 @@ describe('UrlFunTest', function () { for(var key of params.keys()) { arr[i] = key i++ - }; + } expect(arr[2]).assertEqual("key3"); }) @@ -604,7 +604,7 @@ describe('UrlFunTest', function () { for(var key of params.keys()) { arr[i] = key i++ - }; + } expect(arr[3]).assertEqual("key4"); }) @@ -621,7 +621,7 @@ describe('UrlFunTest', function () { for(var key of params.keys()) { arr[i] = key i++ - }; + } expect(arr[4]).assertEqual("key5"); }) diff --git a/compileruntime/url_lib_standard/src/main/js/test/url.test.js.bak b/compileruntime/url_lib_standard/src/main/js/test/url.test.js.bak index df118e5be54a9f568520c5fab6d845bff61e80d0..83f3e8e0076c4e5a76914ad589181490d9e25c6f 100644 --- a/compileruntime/url_lib_standard/src/main/js/test/url.test.js.bak +++ b/compileruntime/url_lib_standard/src/main/js/test/url.test.js.bak @@ -15,6 +15,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/lite' import Url from '@ohos.url' describe('UrlFunTest', function () { + /** * @tc.name: testUrlAppend001 * @tc.desc: Appends a specified key/value pair as a new search parameter. @@ -267,7 +268,7 @@ describe('UrlFunTest', function () { { arr[i] = value + " " + key + " " + (params === SearchParams) i++ - }; + } params.forEach(func); expect(arr[0]).assertEqual("value1 key1 true"); }) @@ -325,7 +326,7 @@ describe('UrlFunTest', function () { { arr[i] = value + " " + key + " " + (params === SearchParams) i++ - }; + } params.forEach(func); expect(arr[1]).assertEqual("txt jss true"); }) diff --git a/compileruntime/util_lib_standard/src/main/js/test/util.test.js b/compileruntime/util_lib_standard/src/main/js/test/util.test.js index 7ed00ae2365cb3396c8c8ba03f4eacfea4838165..b46e407cfb31b3c3360b509587c61344e2808900 100644 --- a/compileruntime/util_lib_standard/src/main/js/test/util.test.js +++ b/compileruntime/util_lib_standard/src/main/js/test/util.test.js @@ -336,7 +336,7 @@ describe('TextEncoderTest', function () { it('testUtilCallbackWrapper002', 0, async function () { async function promiseFn() { return Promise.resolve('value'); - }; + } var cb = util.callbackWrapper(promiseFn); cb((err, ret) => { expect(err).strictEqual(null); @@ -354,7 +354,7 @@ describe('TextEncoderTest', function () { it('testUtilCallbackWrapper003', 0, async function () { async function promiseFn() { return 42; - }; + } var cb = util.callbackWrapper(promiseFn); cb((err, ret) => { expect(err).strictEqual(null); @@ -371,11 +371,13 @@ describe('TextEncoderTest', function () { */ it('testUtilCallbackWrapper004', 0, async function () { async function promiseFn() { - return Promise.reject('value'); - }; + var err = Error('value'); + return Promise.reject(err); + + } var cb = util.callbackWrapper(promiseFn); cb((err, ret) => { - expect(err).strictEqual('value'); + expect(err.message).strictEqual('value'); expect(ret).strictEqual(undefined); }) }) @@ -390,7 +392,7 @@ describe('TextEncoderTest', function () { it('testUtilCallbackWrapper005', 0, async function () { async function promiseFn(a, b) { return a + b; - }; + } var cb = util.callbackWrapper(promiseFn); cb(1, 2, (err, ret) => { expect(err).strictEqual(null); @@ -408,7 +410,7 @@ describe('TextEncoderTest', function () { it('testUtilCallbackWrapper006', 0, async function () { async function promiseFn(){ return null; - }; + } var cb = util.callbackWrapper(promiseFn); try { cb([1, 2]) @@ -4446,7 +4448,7 @@ describe('LruBufferFunTest', function () { i++; arr[i]=entry[1]; i++; - }; + } expect(arr[1]).assertEqual('abc'); }) @@ -4469,7 +4471,7 @@ describe('LruBufferFunTest', function () { i++; arr[i]=entry[1]; i++; - }; + } expect(arr[1]).assertEqual(2); }) @@ -4493,7 +4495,7 @@ describe('LruBufferFunTest', function () { i++; arr[i]=entry[1]; i++; - }; + } expect(arr[0]).assertEqual(1); }) @@ -4518,7 +4520,7 @@ describe('LruBufferFunTest', function () { i++; arr[i]=entry[1]; i++; - }; + } expect(arr[1]).assertEqual(15) expect(arr[3]).assertEqual(20) }) @@ -4547,7 +4549,7 @@ describe('LruBufferFunTest', function () { i++; arr[i]=entry[1]; i++; - }; + } expect(arr[1]).assertEqual(10) expect(arr[3]).assertEqual(2) expect(arr[5]).assertEqual(20) @@ -4570,7 +4572,7 @@ describe('LruBufferFunTest', function () { i++; arr[i]=entry[1]; i++; - }; + } expect(arr[1]).assertEqual('abc'); }) @@ -4593,7 +4595,7 @@ describe('LruBufferFunTest', function () { i++; arr[i]=entry[1]; i++; - }; + } expect(arr[1]).assertEqual(2); }) @@ -4617,7 +4619,7 @@ describe('LruBufferFunTest', function () { i++; arr[i]=entry[1]; i++; - }; + } expect(arr[0]).assertEqual(1); }) @@ -4642,7 +4644,7 @@ describe('LruBufferFunTest', function () { i++; arr[i]=entry[1]; i++; - }; + } expect(arr[1]).assertEqual(15) expect(arr[3]).assertEqual(20) }) @@ -4671,7 +4673,7 @@ describe('LruBufferFunTest', function () { i++; arr[i]=entry[1]; i++; - }; + } expect(arr[1]).assertEqual(10) expect(arr[3]).assertEqual(2) expect(arr[5]).assertEqual(20) @@ -6261,7 +6263,8 @@ describe('TypesTest', function() { */ it('testIsPromise004', 0, function() { var proc = new util.Types(); - var result = proc.isPromise(Promise.reject(33)); + var err = Error(33); + var result = proc.isPromise(Promise.reject(err )); expect(result).assertEqual(true); }) diff --git a/compileruntime/util_lib_standard/src/main/js/test/util.test.js.bak b/compileruntime/util_lib_standard/src/main/js/test/util.test.js.bak index f8db23a06ce3a2b995600e3d033e15745d8aec64..fabbba3334220557401a9f3f29385fc3c63e7868 100644 --- a/compileruntime/util_lib_standard/src/main/js/test/util.test.js.bak +++ b/compileruntime/util_lib_standard/src/main/js/test/util.test.js.bak @@ -336,7 +336,7 @@ describe('TextEncoderTest', function () { it('testUtilCallbackWrapper002', 0, async function () { async function promiseFn() { return Promise.resolve('value'); - }; + } var cb = util.callbackWrapper(promiseFn); cb((err, ret) => { expect(err).strictEqual(null); @@ -354,7 +354,7 @@ describe('TextEncoderTest', function () { it('testUtilCallbackWrapper003', 0, async function () { async function promiseFn() { return 42; - }; + } var cb = util.callbackWrapper(promiseFn); cb((err, ret) => { expect(err).strictEqual(null); @@ -371,8 +371,10 @@ describe('TextEncoderTest', function () { */ it('testUtilCallbackWrapper004', 0, async function () { async function promiseFn() { - return Promise.reject('value'); - }; + var err = Error('value'); + return Promise.reject(err); + expect(err.message).strictEqual('value'); + } var cb = util.callbackWrapper(promiseFn); cb((err, ret) => { expect(err).strictEqual('value'); @@ -390,7 +392,7 @@ describe('TextEncoderTest', function () { it('testUtilCallbackWrapper005', 0, async function () { async function promiseFn(a, b) { return a + b; - }; + } var cb = util.callbackWrapper(promiseFn); cb(1, 2, (err, ret) => { expect(err).strictEqual(null); @@ -408,7 +410,7 @@ describe('TextEncoderTest', function () { it('testUtilCallbackWrapper006', 0, async function () { async function promiseFn(){ return null; - }; + } var cb = util.callbackWrapper(promiseFn); try { cb([1, 2]) @@ -4446,7 +4448,7 @@ describe('LruBufferFunTest', function () { i++; arr[i]=entry[1]; i++; - }; + } expect(arr[1]).assertEqual('abc'); }) @@ -4469,7 +4471,7 @@ describe('LruBufferFunTest', function () { i++; arr[i]=entry[1]; i++; - }; + } expect(arr[1]).assertEqual(2); }) @@ -4493,7 +4495,7 @@ describe('LruBufferFunTest', function () { i++; arr[i]=entry[1]; i++; - }; + } expect(arr[0]).assertEqual(1); }) @@ -4518,7 +4520,7 @@ describe('LruBufferFunTest', function () { i++; arr[i]=entry[1]; i++; - }; + } expect(arr[1]).assertEqual(15) expect(arr[3]).assertEqual(20) }) @@ -4547,7 +4549,7 @@ describe('LruBufferFunTest', function () { i++; arr[i]=entry[1]; i++; - }; + } expect(arr[1]).assertEqual(10) expect(arr[3]).assertEqual(2) expect(arr[5]).assertEqual(20) @@ -4570,7 +4572,7 @@ describe('LruBufferFunTest', function () { i++; arr[i]=entry[1]; i++; - }; + } expect(arr[1]).assertEqual('abc'); }) @@ -4593,7 +4595,7 @@ describe('LruBufferFunTest', function () { i++; arr[i]=entry[1]; i++; - }; + } expect(arr[1]).assertEqual(2); }) @@ -4617,7 +4619,7 @@ describe('LruBufferFunTest', function () { i++; arr[i]=entry[1]; i++; - }; + } expect(arr[0]).assertEqual(1); }) @@ -4642,7 +4644,7 @@ describe('LruBufferFunTest', function () { i++; arr[i]=entry[1]; i++; - }; + } expect(arr[1]).assertEqual(15) expect(arr[3]).assertEqual(20) }) @@ -4671,7 +4673,7 @@ describe('LruBufferFunTest', function () { i++; arr[i]=entry[1]; i++; - }; + } expect(arr[1]).assertEqual(10) expect(arr[3]).assertEqual(2) expect(arr[5]).assertEqual(20) @@ -4913,7 +4915,9 @@ describe('TypesTest', function() { /** * @tc.name: testIsArrayBufferView001 - * @tc.desc: Check whether the entered value is napi_ int8_ array or napi_ uint8_ array or naPi_ uint8_ clamped_ array or naPi_ int16_ array or naPi_ uint16_ array or napi_ int32_ array or napi_ uint32_ array or napi_ float32_ array or napi_ float64_ array array or DataView type. + * @tc.desc: Check whether the entered value is napi_ int8_ array or napi_ uint8_ array + or naPi_ uint8_ clamped_ array or naPi_ int16_ array or naPi_ uint16_ array or napi_ int32_ array or napi_ + uint32_ array or napi_ float32_ array or napi_ float64_ array array or DataView type. * @tc.require: AR000GFB59 * @tc.author: wangjingwu */ @@ -4925,7 +4929,9 @@ describe('TypesTest', function() { /** * @tc.name: testIsArrayBufferView002 - * @tc.desc: Check whether the entered value is napi_ int8_ array or napi_ uint8_ array or naPi_ uint8_ clamped_ array or naPi_ int16_ array or naPi_ uint16_ array or napi_ int32_ array or napi_ uint32_ array or napi_ float32_ array or napi_ float64_ array array or DataView type. + * @tc.desc: Check whether the entered value is napi_ int8_ array or napi_ uint8_ array + or naPi_ uint8_ clamped_ array or naPi_ int16_ array or naPi_ uint16_ array or napi_ + int32_ array or napi_ uint32_ array or napi_ float32_ array or napi_ float64_ array array or DataView type. * @tc.require: AR000GFB59 * @tc.author: wangjingwu */ @@ -4937,7 +4943,9 @@ describe('TypesTest', function() { /** * @tc.name: testIsArrayBufferView003 - * @tc.desc: Check whether the entered value is napi_ int8_ array or napi_ uint8_ array or naPi_ uint8_ clamped_ array or naPi_ int16_ array or naPi_ uint16_ array or napi_ int32_ array or napi_ uint32_ array or napi_ float32_ array or napi_ float64_ array array or DataView type. + * @tc.desc: Check whether the entered value is napi_ int8_ array or napi_ uint8_ + array or naPi_ uint8_ clamped_ array or naPi_ int16_ array or naPi_ uint16_ array or napi_ int32_ array or + napi_ uint32_ array or napi_ float32_ array or napi_ float64_ array array or DataView type. * @tc.require: AR000GFB59 * @tc.author: wangjingwu */ @@ -4949,7 +4957,9 @@ describe('TypesTest', function() { /** * @tc.name: testIsArrayBufferView004 - * @tc.desc: Check whether the entered value is napi_ int8_ array or napi_ uint8_ array or naPi_ uint8_ clamped_ array or naPi_ int16_ array or naPi_ uint16_ array or napi_ int32_ array or napi_ uint32_ array or napi_ float32_ array or napi_ float64_ array array or DataView type. + * @tc.desc: Check whether the entered value is napi_ int8_ array or napi_ uint8_ array or naPi_ uint8_ + clamped_ array or naPi_ int16_ array or naPi_ uint16_ array or napi_ int32_ array or napi_ uint32_ array or + napi_ float32_ array or napi_ float64_ array array or DataView type. * @tc.require: AR000GFB59 * @tc.author: wangjingwu */ @@ -4961,7 +4971,9 @@ describe('TypesTest', function() { /** * @tc.name: testIsArrayBufferView005 - * @tc.desc: Check whether the entered value is napi_ int8_ array or napi_ uint8_ array or naPi_ uint8_ clamped_ array or naPi_ int16_ array or naPi_ uint16_ array or napi_ int32_ array or napi_ uint32_ array or napi_ float32_ array or napi_ float64_ array array or DataView type. + * @tc.desc: Check whether the entered value is napi_ int8_ array or napi_ uint8_ array or naPi_ uint8_ + clamped_ array or naPi_ int16_ array or naPi_ uint16_ array or napi_ int32_ array or napi_ uint32_ array or + napi_ float32_ array or napi_ float64_ array array or DataView type. * @tc.require: AR000GFB59 * @tc.author: wangjingwu */