未验证 提交 9a866e32 编写于 作者: O openharmony_ci 提交者: Gitee

!1891 Replace lite with index

Merge pull request !1891 from 小马奔腾/master
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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' import convertXml from '@ohos.convertxml'
describe('XmlTest', function () { describe('XmlTest', function () {
......
...@@ -12,22 +12,298 @@ ...@@ -12,22 +12,298 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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' import process from '@ohos.process'
describe('ChildProcessTest', function () { 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 * @tc.name: testWait001
* @tc.desc: return 'number' is the targer process exit code. * @tc.desc: return 'number' is the targer process exit code.
* @tc.require: AR000GFB2S * @tc.require: AR000GFB2S
* @tc.author: wangben * @tc.author: wangben
*/ */
it('testWait001', 0, async function () { it('testWait001', 0, async function (done) {
var child = process.runCmd('ls') var child = process.runCmd('ls')
var status = child.wait() await child.wait().then(val=>{
status.then(val=>{
expect(val).assertEqual(0) expect(val).assertEqual(0)
}) });
done();
}) })
/** /**
...@@ -36,13 +312,13 @@ describe('ChildProcessTest', function () { ...@@ -36,13 +312,13 @@ describe('ChildProcessTest', function () {
* @tc.require: AR000GFB2S * @tc.require: AR000GFB2S
* @tc.author: wangben * @tc.author: wangben
*/ */
it('testWait002', 0, async function () { it('testWait002', 0, async function (done) {
var child = process.runCmd('ls; sleep 5;') var child = process.runCmd('ls; sleep 5;')
child.kill(9); child.kill(9);
var status = child.wait() await child.wait().then(val=>{
status.then(val=>{
expect(val).assertEqual(9) expect(val).assertEqual(9)
}) });
done();
}) })
/** /**
...@@ -51,12 +327,12 @@ describe('ChildProcessTest', function () { ...@@ -51,12 +327,12 @@ describe('ChildProcessTest', function () {
* @tc.require: AR000GFB2S * @tc.require: AR000GFB2S
* @tc.author: wangben * @tc.author: wangben
*/ */
it('testWait003', 0, async function () { it('testWait003', 0, async function (done) {
var child = process.runCmd('echo helloWorld'); var child = process.runCmd('echo helloWorld');
var status = child.wait(); await child.wait().then(val=>{
status.then(val=>{
expect(val).assertEqual(0); expect(val).assertEqual(0);
}) });
done();
}) })
/** /**
...@@ -65,12 +341,12 @@ describe('ChildProcessTest', function () { ...@@ -65,12 +341,12 @@ describe('ChildProcessTest', function () {
* @tc.require: AR000GFB2S * @tc.require: AR000GFB2S
* @tc.author: wangben * @tc.author: wangben
*/ */
it('testWait004', 0, async function () { it('testWait004', 0, async function (done) {
var child = process.runCmd('mkdir 123'); var child = process.runCmd('mkdir 123');
var status = child.wait(); await child.wait().then(val=>{
status.then(val=>{ expect(val).assertEqual(0);
expect(val).assertEqual(256); });
}) done();
}) })
/** /**
...@@ -79,12 +355,12 @@ describe('ChildProcessTest', function () { ...@@ -79,12 +355,12 @@ describe('ChildProcessTest', function () {
* @tc.require: AR000GFB2S * @tc.require: AR000GFB2S
* @tc.author: wangben * @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 child = process.runCmd('sleep 5; echo abc;', { timeout : 1, killSignal : 9 });
var status = child.wait(); await child.wait().then(val=>{
status.then(val=>{
expect(val).assertEqual(9); expect(val).assertEqual(9);
}) });
done();
}) })
/** /**
...@@ -1510,7 +1786,7 @@ describe('ChildProcessTest', function () { ...@@ -1510,7 +1786,7 @@ describe('ChildProcessTest', function () {
{ {
var flag = new Boolean(true) var flag = new Boolean(true)
} }
expect(flag).assertEqual(true) expect(Boolean(flag)).assertEqual(true)
}) })
/** /**
...@@ -1527,7 +1803,7 @@ describe('ChildProcessTest', function () { ...@@ -1527,7 +1803,7 @@ describe('ChildProcessTest', function () {
{ {
var flag = new Boolean(true) var flag = new Boolean(true)
} }
expect(flag).assertEqual(true) expect(Boolean(flag)).assertEqual(true)
} }
}) })
...@@ -1545,7 +1821,7 @@ describe('ChildProcessTest', function () { ...@@ -1545,7 +1821,7 @@ describe('ChildProcessTest', function () {
{ {
var flag = new Boolean(true) var flag = new Boolean(true)
} }
expect(flag).assertEqual(true) expect(Boolean(flag)).assertEqual(true)
} }
}) })
...@@ -1696,7 +1972,7 @@ describe('ChildProcessTest', function () { ...@@ -1696,7 +1972,7 @@ describe('ChildProcessTest', function () {
if(pres != -1) if(pres != -1)
{ {
var flag = new Boolean(true) var flag = new Boolean(true)
expect(flag).assertEqual(true) expect(Boolean(flag)).assertEqual(true)
} }
}) })
...@@ -1741,7 +2017,7 @@ describe('ChildProcessTest', function () { ...@@ -1741,7 +2017,7 @@ describe('ChildProcessTest', function () {
if(pri) if(pri)
{ {
var flag = new Boolean(true) var flag = new Boolean(true)
expect(flag).assertEqual(true) expect(Boolean(flag)).assertEqual(true)
} }
}) })
...@@ -1759,7 +2035,7 @@ describe('ChildProcessTest', function () { ...@@ -1759,7 +2035,7 @@ describe('ChildProcessTest', function () {
if(pri > 0) if(pri > 0)
{ {
var flag = new Boolean(true) var flag = new Boolean(true)
expect(flag).assertEqual(true) expect(Boolean(flag)).assertEqual(true)
} }
} }
}) })
...@@ -1778,7 +2054,7 @@ describe('ChildProcessTest', function () { ...@@ -1778,7 +2054,7 @@ describe('ChildProcessTest', function () {
if(pri > 0) if(pri > 0)
{ {
var flag = new Boolean(true) var flag = new Boolean(true)
expect(flag).assertEqual(true) expect(Boolean(flag)).assertEqual(true)
} }
} }
}) })
...@@ -1798,7 +2074,7 @@ describe('ChildProcessTest', function () { ...@@ -1798,7 +2074,7 @@ describe('ChildProcessTest', function () {
{ {
var flag = new Boolean(true) var flag = new Boolean(true)
} }
expect(flag).assertEqual(true) expect(Boolean(flag)).assertEqual(true)
} }
}) })
...@@ -1815,7 +2091,7 @@ describe('ChildProcessTest', function () { ...@@ -1815,7 +2091,7 @@ describe('ChildProcessTest', function () {
{ {
var flag = new Boolean(true) var flag = new Boolean(true)
} }
expect(flag).assertEqual(true) expect(Boolean(flag)).assertEqual(true)
}) })
/** /**
...@@ -1833,7 +2109,7 @@ describe('ChildProcessTest', function () { ...@@ -1833,7 +2109,7 @@ describe('ChildProcessTest', function () {
{ {
var flag = new Boolean(true) var flag = new Boolean(true)
} }
expect(flag).assertEqual(true) expect(Boolean(flag)).assertEqual(true)
} }
}) })
...@@ -1852,7 +2128,7 @@ describe('ChildProcessTest', function () { ...@@ -1852,7 +2128,7 @@ describe('ChildProcessTest', function () {
{ {
var flag = new Boolean(true) var flag = new Boolean(true)
} }
expect(flag).assertEqual(true) expect(Boolean(flag)).assertEqual(true)
} }
}) })
...@@ -1870,7 +2146,7 @@ describe('ChildProcessTest', function () { ...@@ -1870,7 +2146,7 @@ describe('ChildProcessTest', function () {
{ {
var flag = new Boolean(true) var flag = new Boolean(true)
} }
expect(flag).assertEqual(true) expect(Boolean(flag)).assertEqual(true)
} }
}) })
...@@ -1886,7 +2162,7 @@ describe('ChildProcessTest', function () { ...@@ -1886,7 +2162,7 @@ describe('ChildProcessTest', function () {
{ {
var flag = new Boolean(true) var flag = new Boolean(true)
} }
expect(flag).assertEqual(true) expect(Boolean(flag)).assertEqual(true)
}) })
/** /**
...@@ -1903,7 +2179,7 @@ describe('ChildProcessTest', function () { ...@@ -1903,7 +2179,7 @@ describe('ChildProcessTest', function () {
{ {
var flag = new Boolean(true) var flag = new Boolean(true)
} }
expect(flag).assertEqual(true) expect(Boolean(flag)).assertEqual(true)
} }
}) })
...@@ -1921,7 +2197,7 @@ describe('ChildProcessTest', function () { ...@@ -1921,7 +2197,7 @@ describe('ChildProcessTest', function () {
{ {
var flag = new Boolean(true) var flag = new Boolean(true)
} }
expect(flag).assertEqual(true) expect(Boolean(flag)).assertEqual(true)
} }
}) })
...@@ -1938,7 +2214,7 @@ describe('ChildProcessTest', function () { ...@@ -1938,7 +2214,7 @@ describe('ChildProcessTest', function () {
{ {
var flag = new Boolean(true) var flag = new Boolean(true)
} }
expect(flag).assertEqual(true) expect(Boolean(flag)).assertEqual(true)
}) })
/** /**
...@@ -1956,7 +2232,7 @@ describe('ChildProcessTest', function () { ...@@ -1956,7 +2232,7 @@ describe('ChildProcessTest', function () {
{ {
var flag = new Boolean(true) var flag = new Boolean(true)
} }
expect(flag).assertEqual(true) expect(Boolean(flag)).assertEqual(true)
} }
}) })
...@@ -1975,7 +2251,7 @@ describe('ChildProcessTest', function () { ...@@ -1975,7 +2251,7 @@ describe('ChildProcessTest', function () {
{ {
var flag = new Boolean(true) var flag = new Boolean(true)
} }
expect(flag).assertEqual(true) expect(Boolean(flag)).assertEqual(true)
} }
}) })
...@@ -1992,7 +2268,7 @@ describe('ChildProcessTest', function () { ...@@ -1992,7 +2268,7 @@ describe('ChildProcessTest', function () {
{ {
var flag = new Boolean(true) var flag = new Boolean(true)
} }
expect(flag).assertEqual(true) expect(Boolean(flag)).assertEqual(true)
}) })
/** /**
...@@ -2008,7 +2284,7 @@ describe('ChildProcessTest', function () { ...@@ -2008,7 +2284,7 @@ describe('ChildProcessTest', function () {
{ {
var flag = new Boolean(true) var flag = new Boolean(true)
} }
expect(flag).assertEqual(true) expect(Boolean(flag)).assertEqual(true)
}) })
/** /**
...@@ -2023,7 +2299,7 @@ describe('ChildProcessTest', function () { ...@@ -2023,7 +2299,7 @@ describe('ChildProcessTest', function () {
{ {
var flag = new Boolean(true) var flag = new Boolean(true)
} }
expect(flag).assertEqual(true) expect(Boolean(flag)).assertEqual(true)
}) })
/** /**
...@@ -2040,7 +2316,7 @@ describe('ChildProcessTest', function () { ...@@ -2040,7 +2316,7 @@ describe('ChildProcessTest', function () {
{ {
var flag = new Boolean(true) var flag = new Boolean(true)
} }
expect(flag).assertEqual(true) expect(Boolean(flag)).assertEqual(true)
} }
}) })
...@@ -2058,7 +2334,7 @@ describe('ChildProcessTest', function () { ...@@ -2058,7 +2334,7 @@ describe('ChildProcessTest', function () {
{ {
var flag = new Boolean(true) var flag = new Boolean(true)
} }
expect(flag).assertEqual(true) expect(Boolean(flag)).assertEqual(true)
} }
}) })
...@@ -2073,7 +2349,7 @@ describe('ChildProcessTest', function () { ...@@ -2073,7 +2349,7 @@ describe('ChildProcessTest', function () {
var pri = process.getEnvironmentVar("USER") var pri = process.getEnvironmentVar("USER")
if(pri != null) { if(pri != null) {
var flag = new Boolean(true) var flag = new Boolean(true)
expect(flag).assertEqual(true) expect(Boolean(flag)).assertEqual(true)
} }
}) })
...@@ -2090,7 +2366,7 @@ describe('ChildProcessTest', function () { ...@@ -2090,7 +2366,7 @@ describe('ChildProcessTest', function () {
if(pri != null) if(pri != null)
{ {
var flag = new Boolean(true) var flag = new Boolean(true)
expect(flag).assertEqual(true) expect(Boolean(flag)).assertEqual(true)
} }
} }
}) })
...@@ -2108,7 +2384,7 @@ describe('ChildProcessTest', function () { ...@@ -2108,7 +2384,7 @@ describe('ChildProcessTest', function () {
if(pri != null) if(pri != null)
{ {
var flag = new Boolean(true) var flag = new Boolean(true)
expect(flag).assertEqual(true) expect(Boolean(flag)).assertEqual(true)
} }
} }
}) })
...@@ -2126,7 +2402,7 @@ describe('ChildProcessTest', function () { ...@@ -2126,7 +2402,7 @@ describe('ChildProcessTest', function () {
if(pri != null) if(pri != null)
{ {
var flag = new Boolean(true) var flag = new Boolean(true)
expect(flag).assertEqual(true) expect(Boolean(flag)).assertEqual(true)
} }
} }
}) })
...@@ -2144,7 +2420,7 @@ describe('ChildProcessTest', function () { ...@@ -2144,7 +2420,7 @@ describe('ChildProcessTest', function () {
if(pri != null) if(pri != null)
{ {
var flag = new Boolean(true) var flag = new Boolean(true)
expect(flag).assertEqual(true) expect(Boolean(flag)).assertEqual(true)
} }
} }
}) })
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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' import Uri from '@ohos.uri'
describe('UriTest', function () { describe('UriTest', function () {
...@@ -26,7 +26,7 @@ describe('UriTest', function () { ...@@ -26,7 +26,7 @@ describe('UriTest', function () {
try { try {
let that = new Uri.URI('#http://username:password@host:8080/directory/file?foo=1&bar=2'); let that = new Uri.URI('#http://username:password@host:8080/directory/file?foo=1&bar=2');
} catch (err) { } 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 () { ...@@ -40,7 +40,7 @@ describe('UriTest', function () {
try { try {
let that = new Uri.URI({name: 'gaogao'}); let that = new Uri.URI({name: 'gaogao'});
} catch (err) { } catch (err) {
expect(err).assertEqual("Error: input type err"); expect(err.toString()).assertEqual("Error: input type err");
} }
}) })
...@@ -54,7 +54,7 @@ describe('UriTest', function () { ...@@ -54,7 +54,7 @@ describe('UriTest', function () {
try { try {
let that = new Uri.URI('ht/tp://username:pas sword@host:8080/directory/file?foo=1&bar=2'); let that = new Uri.URI('ht/tp://username:pas sword@host:8080/directory/file?foo=1&bar=2');
} catch (err) { } 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 () { ...@@ -68,7 +68,7 @@ describe('UriTest', function () {
try { try {
let that = new Uri.URI('http://username:password@[::]:8080/directory/file?Query#gaogao faofao'); let that = new Uri.URI('http://username:password@[::]:8080/directory/file?Query#gaogao faofao');
} catch (err) { } 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 () { ...@@ -82,7 +82,7 @@ describe('UriTest', function () {
try { try {
let that = new Uri.URI('http://username:password@host:8080/directory/file?foo^=1&bar=2#gaogaofaofao'); let that = new Uri.URI('http://username:password@host:8080/directory/file?foo^=1&bar=2#gaogaofaofao');
} catch (err) { } 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 () { ...@@ -96,7 +96,7 @@ describe('UriTest', function () {
try { try {
let that = new Uri.URI('1http://username:password@host:8080/directory/file?foo=1&bar=2#gaogaofaofao'); let that = new Uri.URI('1http://username:password@host:8080/directory/file?foo=1&bar=2#gaogaofaofao');
} catch (err) { } 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 () { ...@@ -110,7 +110,7 @@ describe('UriTest', function () {
try { try {
let that = new Uri.URI('ht@tp://username:password@host:8080/directory/file?foo=1&bar=2#gaogaofaofao'); let that = new Uri.URI('ht@tp://username:password@host:8080/directory/file?foo=1&bar=2#gaogaofaofao');
} catch (err) { } 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 () { ...@@ -124,7 +124,7 @@ describe('UriTest', function () {
try { try {
let that = new Uri.URI('http://username:password@[::]:80r80/directory/file?foo=1&bar=2#gaogaofaofao'); let that = new Uri.URI('http://username:password@[::]:80r80/directory/file?foo=1&bar=2#gaogaofaofao');
} catch (err) { } 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 () { ...@@ -138,7 +138,7 @@ describe('UriTest', function () {
try { try {
let that = new Uri.URI('http://username:password@[::12:55:8080/directory/file?foo=1&bar=2#gaogaofaofao'); let that = new Uri.URI('http://username:password@[::12:55:8080/directory/file?foo=1&bar=2#gaogaofaofao');
} catch (err) { } 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 () { ...@@ -152,7 +152,7 @@ describe('UriTest', function () {
try { try {
let that = new Uri.URI('http://username:pa^ssword@[::12:55]:8080/directory/file?foo=1&bar=2#gaogaofaofao'); let that = new Uri.URI('http://username:pa^ssword@[::12:55]:8080/directory/file?foo=1&bar=2#gaogaofaofao');
} catch (err) { } 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 () { ...@@ -166,7 +166,7 @@ describe('UriTest', function () {
try { try {
let that = new Uri.URI('http://username:password@[::1你2:55]:8080/directory/file?foo=1&bar=2#gaogaofaofao'); let that = new Uri.URI('http://username:password@[::1你2:55]:8080/directory/file?foo=1&bar=2#gaogaofaofao');
} catch (err) { } 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");
} }
}) })
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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' import Url from '@ohos.url'
describe('UrlFunTest', function () { describe('UrlFunTest', function () {
...@@ -423,7 +423,7 @@ describe('UrlFunTest', function () { ...@@ -423,7 +423,7 @@ describe('UrlFunTest', function () {
let params = new Url.URLSearchParams("key1=value1&key2=value2") let params = new Url.URLSearchParams("key1=value1&key2=value2")
params.append("key1","AAA") params.append("key1","AAA")
var result = params.getAll("key1") var result = params.getAll("key1")
expect(result).assertEqual("value1,AAA") expect(result.toString()).assertEqual("value1,AAA")
}) })
/** /**
...@@ -436,7 +436,7 @@ describe('UrlFunTest', function () { ...@@ -436,7 +436,7 @@ describe('UrlFunTest', function () {
let params = new Url.URLSearchParams("key1=value1&8=DEF") let params = new Url.URLSearchParams("key1=value1&8=DEF")
params.append("8","A8A") params.append("8","A8A")
var result = params.getAll("8") var result = params.getAll("8")
expect(result).assertEqual("DEF,A8A") expect(result.toString()).assertEqual("DEF,A8A")
}) })
/** /**
...@@ -449,7 +449,7 @@ describe('UrlFunTest', function () { ...@@ -449,7 +449,7 @@ describe('UrlFunTest', function () {
let params = new Url.URLSearchParams("key1=value1&key2=value2&key3=da") let params = new Url.URLSearchParams("key1=value1&key2=value2&key3=da")
params.append("key3","A3A") params.append("key3","A3A")
var result = params.getAll("key3") var result = params.getAll("key3")
expect(result).assertEqual("da,A3A") expect(result.toString()).assertEqual("da,A3A")
}) })
/** /**
...@@ -462,7 +462,7 @@ describe('UrlFunTest', function () { ...@@ -462,7 +462,7 @@ describe('UrlFunTest', function () {
let params = new Url.URLSearchParams("key1=value1&key2=value2&key3=大") let params = new Url.URLSearchParams("key1=value1&key2=value2&key3=大")
params.append("key3","A3A") params.append("key3","A3A")
var result = params.getAll("key4") var result = params.getAll("key4")
expect(result).assertEqual('') expect(result.toString()).assertEqual('')
}) })
/** /**
...@@ -475,7 +475,7 @@ describe('UrlFunTest', function () { ...@@ -475,7 +475,7 @@ describe('UrlFunTest', function () {
let params = new Url.URLSearchParams("key1=value1&key2=value2&key3=大") let params = new Url.URLSearchParams("key1=value1&key2=value2&key3=大")
params.append("key3","A3A") params.append("key3","A3A")
var result = params.getAll("key2") var result = params.getAll("key2")
expect(result).assertEqual("value2") expect(result.toString()).assertEqual("value2")
}) })
/** /**
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 util from '@ohos.util'
import url from '@ohos.url' import url from '@ohos.url'
import app from '@system.app' import app from '@system.app'
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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' import xml from '@ohos.xml'
describe('XmlSerializerXmlPullParserTest', function () { describe('XmlSerializerXmlPullParserTest', function () {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册