提交 40ec3a6f 编写于 作者: lizhongyi_'s avatar lizhongyi_

Merge branch 'dev' of https://gitcode.net/dcloud/hello-uts into dev

...@@ -278,7 +278,15 @@ export function testArray(): Result { ...@@ -278,7 +278,15 @@ export function testArray(): Result {
expect(array1.unshift(4, 5)).toEqual(5); expect(array1.unshift(4, 5)).toEqual(5);
expect(array1).toEqual([4, 5, 1, 2, 3]); expect(array1).toEqual([4, 5, 1, 2, 3]);
}) })
test("toString", () => {
const array1: number[] = [1, 2, 3];
expect(array1.toString()).toEqual("1,2,3");
const array2 = new Array<string>()
array2.push("a")
array2.push("b")
array2.push("c")
expect(array2.toString()).toEqual("a,b,c");
})
test('reverse', () => { test('reverse', () => {
// const array1: string[] = ['one', 'two', 'three']; // const array1: string[] = ['one', 'two', 'three'];
// const reversed1: string[] = array1.reverse(); // const reversed1: string[] = array1.reverse();
......
...@@ -23,6 +23,14 @@ export function testDate() : Result { ...@@ -23,6 +23,14 @@ export function testDate() : Result {
expect(unixTimeZero).toEqual(0); expect(unixTimeZero).toEqual(0);
expect(javaScriptRelease).toEqual(818035920000); expect(javaScriptRelease).toEqual(818035920000);
}) })
test('toTimeString', () => {
const date1 = new Date('01 Jan 1970 00:00:00 GMT');
const date2 = new Date('December 17, 1995 03:24:00');
expect(date1.toTimeString()).toEqual("08:00:00 GMT+0800");
expect(date2.toTimeString()).toEqual("03:24:00 GMT+0800");
})
test('getDate', () => { test('getDate', () => {
const birthday = new Date('August 19, 1975 23:15:30'); const birthday = new Date('August 19, 1975 23:15:30');
const date1 = birthday.getDate(); const date1 = birthday.getDate();
......
...@@ -58,12 +58,13 @@ export function testMap(): Result { ...@@ -58,12 +58,13 @@ export function testMap(): Result {
expect(map3.get(333)).toEqual(333); expect(map3.get(333)).toEqual(333);
// ios不支持链式调用 // ios不支持链式调用
// myMap.set(1, 'foobar').set(2, 'baz'); // myMap.set(1, 'foobar').set(2, 'baz');
const map4 = new Map<UTSJSONObject,string>(); // const map4 = new Map<UTSJSONObject,string>();
const key1 = {}, key2 = {}; // key 不支持对象
map4.set(key1, '1') // const key1 = {}, key2 = {};
map4.set(key2, '2') // map4.set(key1, '1')
expect(map4.get(key1)).toEqual('1'); // map4.set(key2, '2')
expect(map4.get(key2)).toEqual('2'); // expect(map4.get(key1)).toEqual('1');
// expect(map4.get(key2)).toEqual('2');
const map5 = new Map<string,string>([['key1', 'value1'], ['key2', 'value2']]); const map5 = new Map<string,string>([['key1', 'value1'], ['key2', 'value2']]);
expect(map5.get('key1')).toEqual('value1'); expect(map5.get('key1')).toEqual('value1');
expect(map5.get('key2')).toEqual('value2'); expect(map5.get('key2')).toEqual('value2');
......
...@@ -9,7 +9,7 @@ export class Matchers<T> { ...@@ -9,7 +9,7 @@ export class Matchers<T> {
return return
} }
// #ifndef APP-IOS // #ifndef APP-IOS
// throw new Error(format(expected, this.actual)) throw new Error(format(expected, this.actual))
// #endif // #endif
// #ifdef APP-IOS // #ifdef APP-IOS
NSException(name = NSExceptionName.internalInconsistencyException, reason = format(expected, this.actual)).raise() NSException(name = NSExceptionName.internalInconsistencyException, reason = format(expected, this.actual)).raise()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册