diff --git a/compileruntime/convertxml_lib_standard/src/main/js/test/convertxml.test.js b/compileruntime/convertxml_lib_standard/src/main/js/test/convertxml.test.js index e0fc6ccf301a1f09eeb39c8a346461aa41feeeb3..eeceebd0684ff4dfde64d603d25c05233e17fa13 100644 --- a/compileruntime/convertxml_lib_standard/src/main/js/test/convertxml.test.js +++ b/compileruntime/convertxml_lib_standard/src/main/js/test/convertxml.test.js @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/lite' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import convertXml from '@ohos.convertxml' describe('XmlTest', function () { diff --git a/compileruntime/process_lib_standard/src/main/js/test/Process.test.js b/compileruntime/process_lib_standard/src/main/js/test/Process.test.js index 0169b76fd48faf761d951c9d7f88e2a9de7bef7c..a72ec87331ecc876e4784024788bdf7d8c5892dd 100644 --- a/compileruntime/process_lib_standard/src/main/js/test/Process.test.js +++ b/compileruntime/process_lib_standard/src/main/js/test/Process.test.js @@ -12,9 +12,284 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/lite' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import process from '@ohos.process' describe('ChildProcessTest', function () { + /** + * @tc.name: testRunCmd001 + * @tc.desc: Return a child process object and spawns a new ChildProcess to run the command. + * @tc.require: AR000GFB2S + * @tc.author: wangben + */ + it('testRunCmd001', 0, async function (done) { + var child = process.runCmd('echo abc') + child.wait() + var array = new Uint8Array([97, 98, 99, 10, 0]) + await child.getOutput().then(val=>{ + for (var i = 0; i < array.length; i++) { + expect(val[i]).assertEqual(array[i]) + } + }); + done(); + }) + + /** + * @tc.name: testRunCmd002 + * @tc.desc: Return a child process object and spawns a new ChildProcess to run the command. + * @tc.require: AR000GFB2S + * @tc.author: wangben + */ + it('testRunCmd002', 0, async function (done) { + var child = process.runCmd('echo abc;', { maxBuffer : 2 }) + child.wait() + var array = new Uint8Array([97, 98, 0]) + await child.getOutput().then(val=>{ + for (var i = 0; i < array.length; i++) { + expect(val[i]).assertEqual(array[i]) + } + }); + done(); + }) + + /** + * @tc.name: testRunCmd003 + * @tc.desc: Return a child process object and spawns a new ChildProcess to run the command. + * @tc.require: AR000GFB2S + * @tc.author: wangben + */ + it('testRunCmd003', 0, async function (done) { + var child = process.runCmd('sleep 5; echo abc;', { timeout : 1, killSignal : 9 }) + child.wait() + var array = new Uint8Array([0]) + await child.getOutput().then(val=>{ + for (var i = 0; i < array.length; i++) { + expect(val[i]).assertEqual(array[i]) + } + }); + expect(child.exitCode).assertEqual(9) + done(); + }) + + /** + * @tc.name: testRunCmd004 + * @tc.desc: Return a child process object and spawns a new ChildProcess to run the command. + * @tc.require: AR000GFB2S + * @tc.author: wangben + */ + it('testRunCmd004', 0, async function (done) { + var child = process.runCmd('sleep 2; echo abc;', { timeout : 9000, killSignal : 9 }) + child.wait() + var array = new Uint8Array([97, 98, 99, 10, 0]) + await child.getOutput().then(val=>{ + for (var i = 0; i < array.length; i++) { + expect(val[i]).assertEqual(array[i]) + } + }); + expect(child.exitCode).assertEqual(0) + done(); + }) + + /** + * @tc.name: testRunCmd005 + * @tc.desc: Return a child process object and spawns a new ChildProcess to run the command. + * @tc.require: AR000GFB2S + * @tc.author: wangben + */ + it('testRunCmd005', 0, async function (done) { + var child = process.runCmd('echo abc', { maxBuffer : 1000 }) + child.wait() + var array = new Uint8Array([97, 98, 99, 10, 0]) + await child.getOutput().then(val=>{ + for (var i = 0; i < array.length; i++) { + expect(val[i]).assertEqual(array[i]) + } + }); + done(); + }) + + /** + * @tc.name: testGetOutput001 + * @tc.desc: return it as 'Uint8Array' of the stdout until EOF. + * @tc.require: AR000GFB2S + * @tc.author: wangben + */ + it('testGetOutput001', 0, async function (done) { + var child = process.runCmd('echo bcd;') + var array = new Uint8Array([98, 99, 100, 10, 0]) + child.wait(); + await child.getOutput().then(val=>{ + for (var i = 0; i < array.length; i++) { + expect(val[i]).assertEqual(array[i]) + } + }); + done(); + }) + + /** + * @tc.name: testGetOutput002 + * @tc.desc: return it as 'Uint8Array' of the stdout until EOF. + * @tc.require: AR000GFB2S + * @tc.author: wangben + */ + it('testGetOutput002', 0, async function (done) { + var child = process.runCmd('echo 123;'); + var array = new Uint8Array([49, 50, 51, 10, 0]); + child.wait(); + await child.getOutput().then(val=>{ + for (var i = 0; i < array.length; i++) { + expect(val[i]).assertEqual(array[i]); + } + }); + done(); + }) + + /** + * @tc.name: testGetOutput003 + * @tc.desc: return it as 'Uint8Array' of the stdout until EOF. + * @tc.require: AR000GFB2S + * @tc.author: wangben + */ + it('testGetOutput003', 0, async function (done) { + var child = process.runCmd('echo helloWorld;'); + var array = new Uint8Array([104, 101, 108, 108, 111, 87, 111, 114, 108, 100, 10, 0]); + child.wait(); + await child.getOutput().then(val=>{ + for (var i = 0; i < array.length; i++) { + expect(val[i]).assertEqual(array[i]); + } + }); + done(); + }) + + /** + * @tc.name: testGetOutput004 + * @tc.desc: return it as 'Uint8Array' of the stdout until EOF. + * @tc.require: AR000GFB2S + * @tc.author: wangben + */ + it('testGetOutput004', 0, async function (done) { + var child = process.runCmd('echo 浣犲�?'); + var array = new Uint8Array([230, 181, 163, 231, 138, 178, 239, 191, 189, 63, 10, 0]); + child.wait(); + await child.getOutput().then(val=>{ + for (var i = 0; i < array.length; i++) { + expect(val[i]).assertEqual(array[i]); + } + }); + done(); + }) + + /** + * @tc.name: testGetOutput005 + * @tc.desc: return it as 'Uint8Array' of the stdout until EOF. + * @tc.require: AR000GFB2S + * @tc.author: wangben + */ + it('testGetOutput005', 0, async function (done) { + var child = process.runCmd('echo ~_~;'); + var array = new Uint8Array([126, 95, 126, 10, 0]); + child.wait(); + await child.getOutput().then(val=>{ + for (var i = 0; i < array.length; i++) { + expect(val[i]).assertEqual(array[i]); + } + }); + done(); + }) + + /** + * @tc.name: testGetErrorOutput001 + * @tc.desc: return it as 'Uint8Array of the stderr until EOF. + * @tc.require: AR000GFB2S + * @tc.author: wangben + */ + it('testGetErrorOutput001', 0, async function (done) { + var child = process.runCmd('makdir 1.txt') + child.wait() + var array = new Uint8Array([115, 104, 58, 32, 109, 97, 107, 100, 105, 114, 58, 32, 105, 110, 97, 99, 99, + 101, 115, 115, 105, 98, 108, 101, 32, 111, 114, 32, 110, 111, 116, 32, 102, 111, 117, 110, 100, 10, 0]) + await child.getErrorOutput().then(val=>{ + for (var i = 0; i < array.length; i++) { + expect(val[i]).assertEqual(array[i]) + } + }); + done(); + }) + + /** + * @tc.name: testGetErrorOutput002 + * @tc.desc: return it as 'Uint8Array of the stderr until EOF. + * @tc.require: AR000GFB2S + * @tc.author: wangben + */ + it('testGetErrorOutput002', 0, async function (done) { + var child = process.runCmd('echo "error" 1>&2') + child.wait() + var array = new Uint8Array([101, 114, 114, 111, 114, 10, 0]) + await child.getErrorOutput().then(val=>{ + for (var i = 0; i < array.length; i++) { + expect(val[i]).assertEqual(array[i]) + } + }); + done(); + }) + + /** + * @tc.name: testGetErrorOutput003 + * @tc.desc: return it as 'Uint8Array of the stderr until EOF. + * @tc.require: AR000GFB2S + * @tc.author: wangben + */ + it('testGetErrorOutput003', 0, async function (done) { + var child = process.runCmd('1') + child.wait() + var array = new Uint8Array([115, 104, 58, 32, 49, 58, 32, 105, 110, 97, 99, 99, 101, 115, 115, 105, 98, + 108, 101, 32, 111, 114, 32, 110, 111, 116, 32, 102, 111, 117, 110, 100, 10, 0]) + await child.getErrorOutput().then(val=>{ + for (var i = 0; i < array.length; i++) { + expect(val[i]).assertEqual(array[i]) + } + }); + done(); + }) + + /** + * @tc.name: testGetErrorOutput004 + * @tc.desc: return it as 'Uint8Array of the stderr until EOF. + * @tc.require: AR000GFB2S + * @tc.author: wangben + */ + it('testGetErrorOutput004', 0, async function (done) { + var child = process.runCmd('chmod 777 123') + var array = new Uint8Array([99, 104, 109, 111, 100, 58, 32, 49, 50, 51, 58, 32, 78, 111, 32, 115, 117, 99, + 104, 32, 102, 105, 108, 101, 32, 111, 114, 32, 100, 105, 114, 101, 99, 116, 111, 114, 121, 10, 0]); + child.wait(); + await child.getErrorOutput().then(val=>{ + for (var i = 0; i < array.length; i++) { + expect(val[i]).assertEqual(array[i]) + } + }); + done(); + }) + + /** + * @tc.name: testGetErrorOutput005 + * @tc.desc: return it as 'Uint8Array of the stderr until EOF. + * @tc.require: AR000GFB2S + * @tc.author: wangben + */ + it('testGetErrorOutput005', 0, async function (done) { + var child = process.runCmd('cp ./1 ./2') + var array = new Uint8Array([99, 112, 58, 32, 98, 97, 100, 32, 39, 46, 47, 49, 39, 58, 32, 78, 111, 32, 115, + 117, 99, 104, 32, 102, 105, 108, 101, 32, 111, 114, 32, 100, 105, 114, 101, 99, 116, 111, 114, 121, 10, 0]) + child.wait(); + await child.getErrorOutput().then(val=>{ + for (var i = 0; i < array.length; i++) { + expect(val[i]).assertEqual(array[i]) + } + }); + done(); + }) /** * @tc.name: testWait001 @@ -22,12 +297,12 @@ describe('ChildProcessTest', function () { * @tc.require: AR000GFB2S * @tc.author: wangben */ - it('testWait001', 0, async function () { + it('testWait001', 0, async function (done) { var child = process.runCmd('ls') - var status = child.wait() - status.then(val=>{ + await child.wait().then(val=>{ expect(val).assertEqual(0) - }) + }); + done(); }) /** @@ -36,13 +311,13 @@ describe('ChildProcessTest', function () { * @tc.require: AR000GFB2S * @tc.author: wangben */ - it('testWait002', 0, async function () { + it('testWait002', 0, async function (done) { var child = process.runCmd('ls; sleep 5;') child.kill(9); - var status = child.wait() - status.then(val=>{ + await child.wait().then(val=>{ expect(val).assertEqual(9) - }) + }); + done(); }) /** @@ -51,12 +326,12 @@ describe('ChildProcessTest', function () { * @tc.require: AR000GFB2S * @tc.author: wangben */ - it('testWait003', 0, async function () { + it('testWait003', 0, async function (done) { var child = process.runCmd('echo helloWorld'); - var status = child.wait(); - status.then(val=>{ + await child.wait().then(val=>{ expect(val).assertEqual(0); - }) + }); + done(); }) /** @@ -65,12 +340,12 @@ describe('ChildProcessTest', function () { * @tc.require: AR000GFB2S * @tc.author: wangben */ - it('testWait004', 0, async function () { + it('testWait004', 0, async function (done) { var child = process.runCmd('mkdir 123'); - var status = child.wait(); - status.then(val=>{ - expect(val).assertEqual(256); - }) + await child.wait().then(val=>{ + expect(val).assertEqual(0); + }); + done(); }) /** @@ -79,12 +354,12 @@ describe('ChildProcessTest', function () { * @tc.require: AR000GFB2S * @tc.author: wangben */ - it('testWait005', 0, async function () { + it('testWait005', 0, async function (done) { var child = process.runCmd('sleep 5; echo abc;', { timeout : 1, killSignal : 9 }); - var status = child.wait(); - status.then(val=>{ + await child.wait().then(val=>{ expect(val).assertEqual(9); - }) + }); + done(); }) /** @@ -1510,7 +1785,7 @@ describe('ChildProcessTest', function () { { var flag = new Boolean(true) } - expect(flag).assertEqual(true) + expect(Boolean(flag)).assertEqual(true) }) /** @@ -1527,7 +1802,7 @@ describe('ChildProcessTest', function () { { var flag = new Boolean(true) } - expect(flag).assertEqual(true) + expect(Boolean(flag)).assertEqual(true) } }) @@ -1545,7 +1820,7 @@ describe('ChildProcessTest', function () { { var flag = new Boolean(true) } - expect(flag).assertEqual(true) + expect(Boolean(flag)).assertEqual(true) } }) @@ -1696,7 +1971,7 @@ describe('ChildProcessTest', function () { if(pres != -1) { var flag = new Boolean(true) - expect(flag).assertEqual(true) + expect(Boolean(flag)).assertEqual(true) } }) @@ -1741,7 +2016,7 @@ describe('ChildProcessTest', function () { if(pri) { var flag = new Boolean(true) - expect(flag).assertEqual(true) + expect(Boolean(flag)).assertEqual(true) } }) @@ -1759,7 +2034,7 @@ describe('ChildProcessTest', function () { if(pri > 0) { var flag = new Boolean(true) - expect(flag).assertEqual(true) + expect(Boolean(flag)).assertEqual(true) } } }) @@ -1778,7 +2053,7 @@ describe('ChildProcessTest', function () { if(pri > 0) { var flag = new Boolean(true) - expect(flag).assertEqual(true) + expect(Boolean(flag)).assertEqual(true) } } }) @@ -1798,7 +2073,7 @@ describe('ChildProcessTest', function () { { var flag = new Boolean(true) } - expect(flag).assertEqual(true) + expect(Boolean(flag)).assertEqual(true) } }) @@ -1815,7 +2090,7 @@ describe('ChildProcessTest', function () { { var flag = new Boolean(true) } - expect(flag).assertEqual(true) + expect(Boolean(flag)).assertEqual(true) }) /** @@ -1833,7 +2108,7 @@ describe('ChildProcessTest', function () { { var flag = new Boolean(true) } - expect(flag).assertEqual(true) + expect(Boolean(flag)).assertEqual(true) } }) @@ -1852,7 +2127,7 @@ describe('ChildProcessTest', function () { { var flag = new Boolean(true) } - expect(flag).assertEqual(true) + expect(Boolean(flag)).assertEqual(true) } }) @@ -1870,7 +2145,7 @@ describe('ChildProcessTest', function () { { var flag = new Boolean(true) } - expect(flag).assertEqual(true) + expect(Boolean(flag)).assertEqual(true) } }) @@ -1886,7 +2161,7 @@ describe('ChildProcessTest', function () { { var flag = new Boolean(true) } - expect(flag).assertEqual(true) + expect(Boolean(flag)).assertEqual(true) }) /** @@ -1903,7 +2178,7 @@ describe('ChildProcessTest', function () { { var flag = new Boolean(true) } - expect(flag).assertEqual(true) + expect(Boolean(flag)).assertEqual(true) } }) @@ -1921,7 +2196,7 @@ describe('ChildProcessTest', function () { { var flag = new Boolean(true) } - expect(flag).assertEqual(true) + expect(Boolean(flag)).assertEqual(true) } }) @@ -1938,7 +2213,7 @@ describe('ChildProcessTest', function () { { var flag = new Boolean(true) } - expect(flag).assertEqual(true) + expect(Boolean(flag)).assertEqual(true) }) /** @@ -1956,7 +2231,7 @@ describe('ChildProcessTest', function () { { var flag = new Boolean(true) } - expect(flag).assertEqual(true) + expect(Boolean(flag)).assertEqual(true) } }) @@ -1975,7 +2250,7 @@ describe('ChildProcessTest', function () { { var flag = new Boolean(true) } - expect(flag).assertEqual(true) + expect(Boolean(flag)).assertEqual(true) } }) @@ -1992,7 +2267,7 @@ describe('ChildProcessTest', function () { { var flag = new Boolean(true) } - expect(flag).assertEqual(true) + expect(Boolean(flag)).assertEqual(true) }) /** @@ -2008,7 +2283,7 @@ describe('ChildProcessTest', function () { { var flag = new Boolean(true) } - expect(flag).assertEqual(true) + expect(Boolean(flag)).assertEqual(true) }) /** @@ -2023,7 +2298,7 @@ describe('ChildProcessTest', function () { { var flag = new Boolean(true) } - expect(flag).assertEqual(true) + expect(Boolean(flag)).assertEqual(true) }) /** @@ -2040,7 +2315,7 @@ describe('ChildProcessTest', function () { { var flag = new Boolean(true) } - expect(flag).assertEqual(true) + expect(Boolean(flag)).assertEqual(true) } }) @@ -2058,7 +2333,7 @@ describe('ChildProcessTest', function () { { var flag = new Boolean(true) } - expect(flag).assertEqual(true) + expect(Boolean(flag)).assertEqual(true) } }) @@ -2073,7 +2348,7 @@ describe('ChildProcessTest', function () { var pri = process.getEnvironmentVar("USER") if(pri != null) { var flag = new Boolean(true) - expect(flag).assertEqual(true) + expect(Boolean(flag)).assertEqual(true) } }) @@ -2090,7 +2365,7 @@ describe('ChildProcessTest', function () { if(pri != null) { var flag = new Boolean(true) - expect(flag).assertEqual(true) + expect(Boolean(flag)).assertEqual(true) } } }) @@ -2108,7 +2383,7 @@ describe('ChildProcessTest', function () { if(pri != null) { var flag = new Boolean(true) - expect(flag).assertEqual(true) + expect(Boolean(flag)).assertEqual(true) } } }) @@ -2126,7 +2401,7 @@ describe('ChildProcessTest', function () { if(pri != null) { var flag = new Boolean(true) - expect(flag).assertEqual(true) + expect(Boolean(flag)).assertEqual(true) } } }) @@ -2144,7 +2419,7 @@ describe('ChildProcessTest', function () { if(pri != null) { var flag = new Boolean(true) - expect(flag).assertEqual(true) + expect(Boolean(flag)).assertEqual(true) } } }) diff --git a/compileruntime/uri_lib_standard/src/main/js/test/uri.test.js b/compileruntime/uri_lib_standard/src/main/js/test/uri.test.js index 283f53717e61dd27309be31b3f9f165fc9c056a9..29a76bb02202a57dee24b60ca95cdf2aff1e27ce 100644 --- a/compileruntime/uri_lib_standard/src/main/js/test/uri.test.js +++ b/compileruntime/uri_lib_standard/src/main/js/test/uri.test.js @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/lite' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import Uri from '@ohos.uri' describe('UriTest', function () { @@ -26,7 +26,7 @@ describe('UriTest', function () { try { let that = new Uri.URI('#http://username:password@host:8080/directory/file?foo=1&bar=2'); } catch (err) { - expect(err).assertEqual("Error: #It can't be the first"); + expect(err.toString()).assertEqual("Error: #It can't be the first"); } }) @@ -40,7 +40,7 @@ describe('UriTest', function () { try { let that = new Uri.URI({name: 'gaogao'}); } catch (err) { - expect(err).assertEqual("Error: input type err"); + expect(err.toString()).assertEqual("Error: input type err"); } }) @@ -54,7 +54,7 @@ describe('UriTest', function () { try { let that = new Uri.URI('ht/tp://username:pas sword@host:8080/directory/file?foo=1&bar=2'); } catch (err) { - expect(err).assertEqual("Error: SpecialPath does not conform to the rule"); + expect(err.toString()).assertEqual("Error: SpecialPath does not conform to the rule"); } }) @@ -68,7 +68,7 @@ describe('UriTest', function () { try { let that = new Uri.URI('http://username:password@[::]:8080/directory/file?Query#gaogao faofao'); } catch (err) { - expect(err).assertEqual("Error: Fragment does not conform to the rule"); + expect(err.toString()).assertEqual("Error: Fragment does not conform to the rule"); } }) @@ -82,7 +82,7 @@ describe('UriTest', function () { try { let that = new Uri.URI('http://username:password@host:8080/directory/file?foo^=1&bar=2#gaogaofaofao'); } catch (err) { - expect(err).assertEqual("Error: Query does not conform to the rule"); + expect(err.toString()).assertEqual("Error: Query does not conform to the rule"); } }) @@ -96,7 +96,7 @@ describe('UriTest', function () { try { let that = new Uri.URI('1http://username:password@host:8080/directory/file?foo=1&bar=2#gaogaofaofao'); } catch (err) { - expect(err).assertEqual("Error: Scheme the first character must be a letter"); + expect(err.toString()).assertEqual("Error: Scheme the first character must be a letter"); } }) @@ -110,7 +110,7 @@ describe('UriTest', function () { try { let that = new Uri.URI('ht@tp://username:password@host:8080/directory/file?foo=1&bar=2#gaogaofaofao'); } catch (err) { - expect(err).assertEqual("Error: scheme does not conform to the rule"); + expect(err.toString()).assertEqual("Error: scheme does not conform to the rule"); } }) @@ -124,7 +124,7 @@ describe('UriTest', function () { try { let that = new Uri.URI('http://username:password@[::]:80r80/directory/file?foo=1&bar=2#gaogaofaofao'); } catch (err) { - expect(err).assertEqual("Error: Prot does not conform to the rule"); + expect(err.toString()).assertEqual("Error: Prot does not conform to the rule"); } }) @@ -138,7 +138,7 @@ describe('UriTest', function () { try { let that = new Uri.URI('http://username:password@[::12:55:8080/directory/file?foo=1&bar=2#gaogaofaofao'); } catch (err) { - expect(err).assertEqual("Error: IPv6 is missing a closing bracket"); + expect(err.toString()).assertEqual("Error: IPv6 is missing a closing bracket"); } }) @@ -152,7 +152,7 @@ describe('UriTest', function () { try { let that = new Uri.URI('http://username:pa^ssword@[::12:55]:8080/directory/file?foo=1&bar=2#gaogaofaofao'); } catch (err) { - expect(err).assertEqual("Error: userInfo does not conform to the rule"); + expect(err.toString()).assertEqual("Error: userInfo does not conform to the rule"); } }) @@ -166,7 +166,7 @@ describe('UriTest', function () { try { let that = new Uri.URI('http://username:password@[::1你2:55]:8080/directory/file?foo=1&bar=2#gaogaofaofao'); } catch (err) { - expect(err).assertEqual("Error: ipv6 does not conform to the rule"); + expect(err.toString()).assertEqual("Error: ipv6 does not conform to the rule"); } }) 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 486fe9161140277de2f75323cbcfd7ab23852500..455b99f259e9b837ea1ba24a81d322b9f4aae3ab 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 @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/lite' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import Url from '@ohos.url' describe('UrlFunTest', function () { @@ -423,7 +423,7 @@ describe('UrlFunTest', function () { let params = new Url.URLSearchParams("key1=value1&key2=value2") params.append("key1","AAA") var result = params.getAll("key1") - expect(result).assertEqual("value1,AAA") + expect(result.toString()).assertEqual("value1,AAA") }) /** @@ -436,7 +436,7 @@ describe('UrlFunTest', function () { let params = new Url.URLSearchParams("key1=value1&8=DEF") params.append("8","A8A") var result = params.getAll("8") - expect(result).assertEqual("DEF,A8A") + expect(result.toString()).assertEqual("DEF,A8A") }) /** @@ -449,7 +449,7 @@ describe('UrlFunTest', function () { let params = new Url.URLSearchParams("key1=value1&key2=value2&key3=da") params.append("key3","A3A") var result = params.getAll("key3") - expect(result).assertEqual("da,A3A") + expect(result.toString()).assertEqual("da,A3A") }) /** @@ -462,7 +462,7 @@ describe('UrlFunTest', function () { let params = new Url.URLSearchParams("key1=value1&key2=value2&key3=大") params.append("key3","A3A") var result = params.getAll("key4") - expect(result).assertEqual('') + expect(result.toString()).assertEqual('') }) /** @@ -475,7 +475,7 @@ describe('UrlFunTest', function () { let params = new Url.URLSearchParams("key1=value1&key2=value2&key3=大") params.append("key3","A3A") var result = params.getAll("key2") - expect(result).assertEqual("value2") + expect(result.toString()).assertEqual("value2") }) /** 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 f699ee0d75596ed5021a8863ac337422de04f702..e8c7bcf26ab9a004d88ea6377c85ecff0c53c594 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 @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/lite' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import util from '@ohos.util' import url from '@ohos.url' import app from '@system.app' diff --git a/compileruntime/xml_lib_standard/src/main/js/test/xml.test.js b/compileruntime/xml_lib_standard/src/main/js/test/xml.test.js index 2e2f373c665ae82fbb0538ca7247ab4288505ad6..34386817c1e9fe3b2cc5a80bc13360b349b45498 100644 --- a/compileruntime/xml_lib_standard/src/main/js/test/xml.test.js +++ b/compileruntime/xml_lib_standard/src/main/js/test/xml.test.js @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/lite' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import xml from '@ohos.xml' describe('XmlSerializerXmlPullParserTest', function () {