1/* 2* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd. 3* Licensed under the Apache License, Version 2.0 (the "License"); 4* you may not use this file except in compliance with the License. 5* You may obtain a copy of the License at 6* 7* http://www.apache.org/licenses/LICENSE-2.0 8* 9* Unless required by applicable law or agreed to in writing, software 10* distributed under the License is distributed on an "AS IS" BASIS, 11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12* See the License for the specific language governing permissions and 13* limitations under the License. 14*/ 15import { AsyncCallback, Callback } from './../basic'; 16 17declare namespace napitest { 18 interface TestClass1 { 19 fun11(cb: Callback<number>): void; 20 fun12(cb: Callback<void>): void; 21 fun13(cb: AsyncCallback<number>): void; 22 fun14(cb: AsyncCallback<void>): void; 23 fun15(cb: Callback<number>): string; 24 fun16(tt: Function): void; 25 fun17(tt: Function): string; 26 27 // 针对不同返回值类型测试 28 fun110(cb: (wid: boolean) => string): string; 29 fun111(cb: (wid: boolean) => string): boolean; 30 fun112(cb: (wid: boolean) => string): number; 31 // fun113(cb: (wid: boolean) => string): TestClass2; // 待支持 32 // fun114(cb: (wid: boolean) => string): Human; // 待支持 33 34 // 针对回调返回值类型测试 35 fun210(cb: (wid: boolean) => string): boolean; 36 fun211(cb: (wid: boolean) => boolean): string; 37 fun212(cb: (wid: boolean) => number): string; 38 // fun213(cb: (wid: boolean) => TestClass2): string; 39 // fun214(cb: (wid: boolean) => Human): string; 40 } 41 42 interface TestClass2 { 43 str: string; 44 45 } 46 47 export class Human { 48 name: string; 49 age: number; 50 } 51 52 function fun1(cb: Callback<number>): void; 53 function fun2(cb: Callback<void>): void; 54 function fun3(cb: AsyncCallback<number>): void; 55 function fun4(cb: AsyncCallback<void>): void; 56 function fun5(cb: Callback<number>): string; // to add testcase for return type is not void 57 function fun6(tt: Function): void; 58 function fun7(tt: Function): string; 59 60 // 以下测试用例待增加测试用例 begin 61 function fun8(cb: (wid: boolean) => void): string; 62 63 // 针对不同返回值类型测试 64 function fun10nm(cb: (wid: boolean) => string): string; 65 function fun11nm(cb: (wid: boolean) => string): boolean; 66 function fun12nm(cb: (wid: boolean) => string): number; 67 // function fun13nm(cb: (wid: boolean) => string): TestClass2; // 待支持 68 // function fun14nm(cb: (wid: boolean) => string): Human; // 待支持 69 70 // 针对回调返回值类型测试 71 function fun20nm(cb: (wid: boolean) => string): boolean; 72 function fun21nm(cb: (wid: boolean) => boolean): string; 73 function fun22nm(cb: (wid: boolean) => number): string; 74 // function fun23nm(cb: (wid: boolean) => TestClass2): string; // 待支持 75 // function fun24nm(cb: (wid: boolean) => Human): string; // 待支持 76 77 // // 以下测试用例待支持 78 79 function fun9(cb: (wid: boolean, str: string, tc2:number) => string): string; 80 81 // function fun9(cb: (wid: boolean, str: string, tc2:TestClass2) => string): string; // 回调函数参数个数大于1,待支持 82} 83 84export default napitest; 85