提交 16ce5eee 编写于 作者: 杜庆泉's avatar 杜庆泉

handle merge dev to alpha

...@@ -52,7 +52,8 @@ ...@@ -52,7 +52,8 @@
<view>测试complete:{{ format(testUtsClassInstanceResult['complete']) }}</view> <view>测试complete:{{ format(testUtsClassInstanceResult['complete']) }}</view>
<view>测试callback:{{ format(testUtsClassInstanceResult['callback']) }}</view> <view>测试callback:{{ format(testUtsClassInstanceResult['callback']) }}</view>
<button @click="testUtsClassSetter">点击测试class 示例setter方法</button> <button @click="testUtsClassSetter">点击测试class 示例setter方法</button>
<view>测试setter:{{ format(testUtsClassSetterResult) }}</view> <view>测试setter:{{ format(testUtsClassSetterResult) }}</view>
<view>测试promise返回值:{{ format(testUtsReturnPromiseResult) }}</view>
<button @click="testAll">点击测试所有</button> <button @click="testAll">点击测试所有</button>
<!-- #ifdef APP-IOS --> <!-- #ifdef APP-IOS -->
<button @click="testPromiseStaticMethod">点击测试promise静态方法</button> <button @click="testPromiseStaticMethod">点击测试promise静态方法</button>
...@@ -74,7 +75,8 @@ ...@@ -74,7 +75,8 @@
testAsyncParam3, testAsyncParam3,
Test, Test,
request, request,
SetterTest, SetterTest,
PromiseReturnDemo,
} from "../../uni_modules/uts-syntaxcase"; } from "../../uni_modules/uts-syntaxcase";
// #endif // #endif
// #ifdef APP-IOS // #ifdef APP-IOS
...@@ -143,7 +145,8 @@ ...@@ -143,7 +145,8 @@
complete: null, complete: null,
callback: null callback: null
}, },
testUtsClassSetterResult: null, testUtsClassSetterResult: null,
testUtsReturnPromiseResult: null,
} }
}, },
methods: { methods: {
...@@ -169,7 +172,8 @@ ...@@ -169,7 +172,8 @@
this.testUtsClassSyncWithCallback(); this.testUtsClassSyncWithCallback();
this.testUtsClassAsync(); this.testUtsClassAsync();
this.testUtsClassInstance(); this.testUtsClassInstance();
this.testUtsClassSetter(); this.testUtsClassSetter();
this.testUtsReturnPromise();
}, },
testUtsSync() { testUtsSync() {
this.testUtsSyncResult = false; this.testUtsSyncResult = false;
...@@ -450,6 +454,20 @@ ...@@ -450,6 +454,20 @@
console.error("testUtsClassSetter", e); console.error("testUtsClassSetter", e);
} }
}, },
testUtsReturnPromise() {
this.testUtsReturnPromiseResult = false;
try {
let demo = new PromiseReturnDemo();
demo.test1();
demo.test2();
if (demo.recordRet == 2) {
this.testUtsReturnPromiseResult = true;
}
} catch (e) {
console.error("testUtsClassSetter", e);
}
},
// #ifdef APP-IOS // #ifdef APP-IOS
testPromiseStaticMethod() { testPromiseStaticMethod() {
testPromiseStaticMethod() testPromiseStaticMethod()
......
...@@ -51,7 +51,8 @@ ...@@ -51,7 +51,8 @@
<view>测试complete:{{ format(testUtsClassInstanceResult.complete) }}</view> <view>测试complete:{{ format(testUtsClassInstanceResult.complete) }}</view>
<view>测试callback:{{ format(testUtsClassInstanceResult.callback) }}</view> <view>测试callback:{{ format(testUtsClassInstanceResult.callback) }}</view>
<button @click="testUtsClassSetter">点击测试class 示例setter方法</button> <button @click="testUtsClassSetter">点击测试class 示例setter方法</button>
<view>测试setter:{{ format(testUtsClassSetterResult) }}</view> <view>测试setter:{{ format(testUtsClassSetterResult) }}</view>
<view>测试promise返回值:{{ format(testUtsReturnPromiseResult) }}</view>
<button @click="testAll">点击测试所有</button> <button @click="testAll">点击测试所有</button>
</view> </view>
</template> </template>
...@@ -65,7 +66,8 @@ ...@@ -65,7 +66,8 @@
testAsyncParam3, testAsyncParam3,
Test, Test,
request, request,
SetterTest, SetterTest,
PromiseReturnDemo,
} from "../../uni_modules/uts-syntaxcase"; } from "../../uni_modules/uts-syntaxcase";
// #endif // #endif
let test let test
...@@ -129,7 +131,8 @@ ...@@ -129,7 +131,8 @@
complete: null, complete: null,
callback: null callback: null
}, },
testUtsClassSetterResult: null, testUtsClassSetterResult: null,
testUtsReturnPromiseResult: null,
} }
}, },
methods: { methods: {
...@@ -149,7 +152,8 @@ ...@@ -149,7 +152,8 @@
this.testUtsClassSyncWithCallback(); this.testUtsClassSyncWithCallback();
this.testUtsClassAsync(); this.testUtsClassAsync();
this.testUtsClassInstance(); this.testUtsClassInstance();
this.testUtsClassSetter(); this.testUtsClassSetter();
this.testUtsReturnPromise();
}, },
testUtsSync() { testUtsSync() {
this.testUtsSyncResult = false; this.testUtsSyncResult = false;
...@@ -422,6 +426,20 @@ ...@@ -422,6 +426,20 @@
} catch (e) { } catch (e) {
console.error("testUtsClassSetter", e); console.error("testUtsClassSetter", e);
} }
},
testUtsReturnPromise() {
this.testUtsReturnPromiseResult = false;
try {
let demo = new PromiseReturnDemo();
demo.test1();
demo.test2();
if (demo.recordRet == 2) {
this.testUtsReturnPromiseResult = true;
}
} catch (e) {
console.error("testUtsClassSetter", e);
}
}, },
} }
} }
......
...@@ -468,4 +468,20 @@ export class myClass { ...@@ -468,4 +468,20 @@ export class myClass {
console.log(name); console.log(name);
return name! return name!
} }
} }
\ No newline at end of file
export class PromiseReturnDemo {
recordRet:number = 0
constructor() { }
test1() : Promise<boolean> {
this.recordRet += 1
console.log('test1',this.recordRet)
return Promise.resolve(true);
}
test2() : void {
this.recordRet += 1
console.log('test2',this.recordRet)
}
}
...@@ -80,18 +80,59 @@ class A6 implements IJSONStringify{ ...@@ -80,18 +80,59 @@ class A6 implements IJSONStringify{
} }
// #endif // #endif
class A1 implements IJSONStringify{
toJSON():any|null{
let jsonRet = {
'name': "zhangsan",
'age': 12,
}
return jsonRet
}
}
class A2 implements IJSONStringify{
toJSON():any|null{
return 2
}
}
class A3 implements IJSONStringify{
toJSON():any|null{
return "json"
}
}
class A4 implements IJSONStringify{
toJSON():any|null{
return null
}
}
class A5 implements IJSONStringify{
toJSON():any|null{
return new A1()
}
}
class A6 implements IJSONStringify{
toJSON():any|null{
return new A5()
}
}
export function testJSON() : Result { export function testJSON() : Result {
return describe("JSON", () => { return describe("JSON", () => {
test('custom-stringify', () => { test('custom-stringify', () => {
// #ifdef APP-ANDROID
expect(JSON.stringify(new A1()).length).toEqual(28) expect(JSON.stringify(new A1())!.length).toEqual(28)
expect(JSON.stringify(new A2())).toEqual("2") expect(JSON.stringify(new A2())).toEqual("2")
expect(JSON.stringify(new A3())).toEqual('"json"') expect(JSON.stringify(new A3())).toEqual('"json"')
expect(JSON.stringify(new A4())).toEqual('null') expect(JSON.stringify(new A4())).toEqual('null')
expect(JSON.stringify(new A5()).length).toEqual(28) expect(JSON.stringify(new A5())!.length).toEqual(28)
expect(JSON.stringify(new A6()).length).toEqual(28) expect(JSON.stringify(new A6())!.length).toEqual(28)
// #endif
}) })
test('parse', () => { test('parse', () => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册