From be275e65991198c96b6d1a67b60efddd3f673400 Mon Sep 17 00:00:00 2001 From: sunlian Date: Mon, 14 Apr 2025 19:56:00 +0800 Subject: [PATCH] fix func param type and return type Signed-off-by: sunlian --- src/vscode_plugin/.vscode/launch.json | 12 ++ src/vscode_plugin/package.json | 4 +- src/vscode_plugin/src/gen/gendts.ts | 12 +- src/vscode_plugin/src/gen/gendtscpp.ts | 3 +- src/vscode_plugin/src/gen/gentest.ts | 2 +- src/vscode_plugin/src/model/h2dtsmod.ts | 2 +- src/vscode_plugin/src/parse/parsets.ts | 29 +-- .../src/test/suite/parse/parsetsfunc.test.ts | 191 +++++++++--------- .../src/test/suite/parse/parsetstype.test.ts | 56 ++++- 9 files changed, 194 insertions(+), 117 deletions(-) diff --git a/src/vscode_plugin/.vscode/launch.json b/src/vscode_plugin/.vscode/launch.json index dfa2e994..d29ae0e1 100644 --- a/src/vscode_plugin/.vscode/launch.json +++ b/src/vscode_plugin/.vscode/launch.json @@ -30,6 +30,18 @@ ], "outFiles": ["${workspaceFolder}/out/test/**/*.js"], "preLaunchTask": "npm: watch" + }, + { + "name": "Run Extension Single-Tests", + "type": "extensionHost", + "request": "launch", + "runtimeExecutable": "${execPath}", + "args": [ + "--extensionDevelopmentPath=${workspaceFolder}", + "--extensionTestsPath=${workspaceFolder}/out/test/suite/indexsingle" + ], + "outFiles": ["${workspaceFolder}/out/test/**/*.js"], + "preLaunchTask": "npm: watch" } ] } diff --git a/src/vscode_plugin/package.json b/src/vscode_plugin/package.json index 67b51939..1e6028cf 100644 --- a/src/vscode_plugin/package.json +++ b/src/vscode_plugin/package.json @@ -37,8 +37,7 @@ "type": "boolean", "default": false, "description": "description of output flag" - } - , + }, "genProject.policy": { "type": "number", "default": 1, @@ -231,6 +230,7 @@ "@typescript-eslint/eslint-plugin": "^5.30.0", "@typescript-eslint/parser": "^5.30.0", "@vscode/test-electron": "^1.6.1", + "antlr4ts": "^0.5.0-alpha.4", "eslint": "^8.13.0", "glob": "^7.1.4", "mocha": "^6.1.4", diff --git a/src/vscode_plugin/src/gen/gendts.ts b/src/vscode_plugin/src/gen/gendts.ts index 2fbca3c1..4ceff635 100644 --- a/src/vscode_plugin/src/gen/gendts.ts +++ b/src/vscode_plugin/src/gen/gendts.ts @@ -58,7 +58,8 @@ export function getInterFuncParams(str: string, paramObj: ParamObj[]) { let paramObject: ParamObj = { name: '', type: '', - arraySize: 0 + arraySize: 0, + arraySizeList: [] } let paramArr = replaceAll(str, '*', '').split(','); for (let i = 0; i < paramArr.length; i++) { @@ -102,13 +103,15 @@ export function createParam(parseParamInfo: ParamObj) { let tsParam: ParamObj = { name: '', type: '', - arraySize: 0 + arraySize: 0, + arraySizeList: [] }; let cppParam: ParamObj = { name: '', type: '', - arraySize: 0 + arraySize: 0, + arraySizeList: [] }; tsParam.name = replaceAll(parseParamInfo.name, '*', ''); cppParam.name = tsParam.name; @@ -250,7 +253,8 @@ export function genDtsInterface(path: string, typeList: TypeList[], interfaceLis let paramObj: ParamObj = { name: variableName, type: replaceAll(variabletype, 'struct', '').trim(), - arraySize: 0 + arraySize: 0, + arraySizeList: [] } paramsContent.push(paramObj); } diff --git a/src/vscode_plugin/src/gen/gendtscpp.ts b/src/vscode_plugin/src/gen/gendtscpp.ts index 7df239c8..cd685b87 100644 --- a/src/vscode_plugin/src/gen/gendtscpp.ts +++ b/src/vscode_plugin/src/gen/gendtscpp.ts @@ -253,7 +253,8 @@ export function createFuncParam(params: ParamObj) { let cppParam: ParamObj = { name: '', type: '', - arraySize: 0 + arraySize: 0, + arraySizeList: [] }; cppParam.name = params.name; cppParam.type = getCTypeFromJS(params.type); diff --git a/src/vscode_plugin/src/gen/gentest.ts b/src/vscode_plugin/src/gen/gentest.ts index a78ec5db..ab6a21ea 100644 --- a/src/vscode_plugin/src/gen/gentest.ts +++ b/src/vscode_plugin/src/gen/gentest.ts @@ -34,7 +34,7 @@ export function generateFuncTestCase(funcInfo: FuncInfo, rawFileName: string, t // 调用函数 Logger.getInstance().info("test funcInfo:" + JSON.stringify(funcInfo)); if (getJsType(funcInfo.retType) !== 'void') { - callFunc = util.format('let result: %s = testNapi.%s(%s)\n ', getJsType(funcInfo.retType), funcInfo.genName, funcParamUse); + callFunc = util.format('let result: %s = testNapi.%s(%s)\n ', getJsType(funcInfo.retType), funcInfo.name, funcParamUse); // 加 hilog 打印 hilogContent = util.format('hilog.info(0x0000, "testTag", "Test NAPI %s: ", JSON.stringify(result));\n ', funcInfo.name); hilogContent += util.format('Logger.getInstance().info("testTag", "Test NAPI %s: ", JSON.stringify(result));\n ', funcInfo.name); diff --git a/src/vscode_plugin/src/model/h2dtsmod.ts b/src/vscode_plugin/src/model/h2dtsmod.ts index 851541bd..c549ee49 100644 --- a/src/vscode_plugin/src/model/h2dtsmod.ts +++ b/src/vscode_plugin/src/model/h2dtsmod.ts @@ -66,7 +66,7 @@ export class H2dtsMod extends IModel { Logger.getInstance().error('parse header file error with undefine uri.'); } } catch (e) { - let errmsg = 'parse header file error: ' + JSON.stringify(e); + let errmsg = 'parse header file error: ' + e.message; Logger.getInstance().error(errmsg); this.emmitEventForKey(EVENT_ERROR, -1, errmsg); } diff --git a/src/vscode_plugin/src/parse/parsets.ts b/src/vscode_plugin/src/parse/parsets.ts index 2eff5a36..65d57a08 100644 --- a/src/vscode_plugin/src/parse/parsets.ts +++ b/src/vscode_plugin/src/parse/parsets.ts @@ -79,7 +79,8 @@ export function getTypeAliasSubtypes(typeAlias: ts.TypeAliasDeclaration, list: P list.push({ type: kindStr, name: nameObj.escapedText, - arraySize: 0 + arraySize: 0, + arraySizeList: [] }) return `(${nameObj.escapedText}:${kindStr})`; }); @@ -96,7 +97,8 @@ export function getParamType(paramType: any) { if (paramType === undefined) { return 'void'; } - // 类型为 number + Logger.getInstance().info('getParamType: ' + paramType.kind) + // 类型为 number let paramText = paramType.kind === NUMBER_TYPE ? 'number' : // 类型为 string paramType.kind === STRING_TYPE ? 'string' : @@ -159,14 +161,17 @@ export function doParseTs(filePath: string, sourceCode: string): ParseObj { let returnObjStr = JSON.stringify(member.type); // Logger.getInstance().debug(`returnObjStr: ${returnObjStr} `); let returnObj = JSON.parse(returnObjStr); - returnStr = getParamType(member.type); + returnStr = member.type?.getText(sourceFile); //getParamType(member.type); if (returnObj.typeName) { let returnNameStr = JSON.stringify(returnObj.typeName); let returnName = JSON.parse(returnNameStr).escapedText; let returnArgsStr = JSON.stringify(returnObj.typeArguments); let returnArgsObj = JSON.parse(returnArgsStr); const returnArgs = returnArgsObj.map((argItem: TypeArguments) => { - let argStr = argItem.members.map((memItem: MemberObj) => { + if (argItem.members) { + + } + let argStr = argItem.members ? argItem.members.map((memItem: MemberObj) => { let memNameStr = ''; let memTypeStr = 'void'; if (memItem.name) { @@ -176,7 +181,7 @@ export function doParseTs(filePath: string, sourceCode: string): ParseObj { memTypeStr = memItem.type.escapedText ? memItem.type.escapedText : 'any'; } return `${memNameStr}: ${memTypeStr}`; - }).join(', '); + }).join(', ') : ""; return argStr; }) returnStr = `${returnName} <${returnArgs}>` @@ -192,7 +197,7 @@ export function doParseTs(filePath: string, sourceCode: string): ParseObj { if (param.type) { let paramTypeObjStr = JSON.stringify(param.type); // Logger.getInstance().debug(`paramTypeObjStr: ${paramTypeObjStr} }`); - paramTypeStr = getParamType(param.type); + paramTypeStr = param.type?.getText(sourceFile); //getParamType(param.type); if (JSON.parse(paramTypeObjStr).typeName) { paramTypeStr = JSON.parse(paramTypeObjStr).typeName.escapedText; } @@ -215,7 +220,7 @@ export function doParseTs(filePath: string, sourceCode: string): ParseObj { } else if (ts.isPropertyDeclaration(member) || ts.isPropertyAssignment(member)) { // 判断是否是类的成员变量 if ('type' in member && 'text' in member.name) { - let paramTypeText = getParamType(member.type); + let paramTypeText = member.type?.getText(sourceFile); //getParamType(member.type); let parameter: ParamObj = { name: member.name.text, type: paramTypeText, @@ -278,7 +283,7 @@ export function doParseTs(filePath: string, sourceCode: string): ParseObj { Logger.getInstance().debug(`Type: ${node.name.text}`); let typeItem: TypeObj = { name: node.name.text, - alias: getParamType(node.type), + alias: node.type?.getText(sourceFile), //getParamType(node.type), members: [], functions: [], types: [], @@ -332,7 +337,7 @@ export function doParseTs(filePath: string, sourceCode: string): ParseObj { } // 参数类型节点 const paramType = param.type; - let paramText = getParamType(paramType); + let paramText = param.type?.getText(sourceFile); //getParamType(paramType); Logger.getInstance().debug(` ${paramName}: ${paramText}`); let parameter: ParamObj = { @@ -346,7 +351,7 @@ export function doParseTs(filePath: string, sourceCode: string): ParseObj { // 获取返回值类型 const returnTypeNode = node.type; - let returnTypeText = getParamType(returnTypeNode); + let returnTypeText = node.type?.getText(sourceFile); //getParamType(returnTypeNode); let funcItem: FuncObj = { name: node.name.text, returns: returnTypeText, @@ -367,7 +372,7 @@ export function doParseTs(filePath: string, sourceCode: string): ParseObj { // Logger.getInstance().debug(`Member: ${JSON.stringify(member)}`) if (ts.isMethodDeclaration(member) && member.name) { // 判断是否是方法 - let paramTypeText = getParamType(member.type); + let paramTypeText = member.type?.getText(sourceFile); //getParamType(member.type); let parameter: ParamObj = { name: 'test', type: paramTypeText, @@ -378,7 +383,7 @@ export function doParseTs(filePath: string, sourceCode: string): ParseObj { } else if (ts.isPropertyDeclaration(member) || ts.isPropertyAssignment(member)) { // 判断是否是类的成员变量 if ('type' in member && 'text' in member.name) { - let paramTypeText = getParamType(member.type); + let paramTypeText = member.type?.getText(sourceFile); //getParamType(member.type); let parameter: ParamObj = { name: member.name.text, type: paramTypeText, diff --git a/src/vscode_plugin/src/test/suite/parse/parsetsfunc.test.ts b/src/vscode_plugin/src/test/suite/parse/parsetsfunc.test.ts index 9bb5884a..84241775 100644 --- a/src/vscode_plugin/src/test/suite/parse/parsetsfunc.test.ts +++ b/src/vscode_plugin/src/test/suite/parse/parsetsfunc.test.ts @@ -20,6 +20,7 @@ import * as assert from 'assert'; import * as vscode from 'vscode'; import * as parsec from '../../../parse/parsec'; import * as parsets from '../../../parse/parsets'; +import { Z_UNKNOWN } from 'zlib'; // import * as myExtension from '../../extension'; suite('Parse_Func_TS_Suite', () => { @@ -58,12 +59,12 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcObjList.funcs.length, 1); let funcItem = funcObjList.funcs[0]; assert.strictEqual(funcItem.name, 'add'); - assert.strictEqual(funcItem.returns, 'Array'); + assert.strictEqual(funcItem.returns, 'number[][]'); assert.strictEqual(funcItem.parameters.length, 2); assert.strictEqual(funcItem.parameters[0].name, 'a'); assert.strictEqual(funcItem.parameters[0].type, 'boolean'); assert.strictEqual(funcItem.parameters[1].name, 'b'); - assert.strictEqual(funcItem.parameters[1].type, 'Array'); + assert.strictEqual(funcItem.parameters[1].type, 'number[]'); }); @@ -124,7 +125,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcItem.returns, 'void'); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'a'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, '{x:number, y:number}'); }); @@ -143,7 +144,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcItem.returns, 'void'); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'a'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, '{x:number, y?:string}'); }); @@ -162,7 +163,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcItem.returns, 'void'); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'a'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, 'number | string'); }); @@ -181,7 +182,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcItem.returns, 'void'); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'a'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, 'number | string'); }); @@ -200,7 +201,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcItem.returns, 'void'); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'a'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, '"left" | "right" | "center"'); }); @@ -219,7 +220,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcItem.returns, 'void'); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'a'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, 'string | null'); }); @@ -238,7 +239,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcItem.returns, 'void'); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'a'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, 'string | null'); }); @@ -257,7 +258,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcItem.returns, 'void'); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'fn'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, '(a:string) => void'); }); @@ -276,7 +277,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcItem.returns, 'void'); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'fn'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, '(a?:string) => void'); }); @@ -292,10 +293,10 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcObjList.funcs.length, 1); let funcItem = funcObjList.funcs[0]; assert.strictEqual(funcItem.name, 'add'); - assert.strictEqual(funcItem.returns, 'any'); + assert.strictEqual(funcItem.returns, 'Type | undefined'); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'fn'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, '(a:Type[]) => Type'); }); @@ -311,10 +312,10 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcObjList.funcs.length, 1); let funcItem = funcObjList.funcs[0]; assert.strictEqual(funcItem.name, 'add'); - assert.strictEqual(funcItem.returns, 'any'); + assert.strictEqual(funcItem.returns, 'Output | undefined'); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'fn'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, '(a:Input[]) => Output'); }); @@ -330,7 +331,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcObjList.funcs.length, 1); let funcItem = funcObjList.funcs[0]; assert.strictEqual(funcItem.name, 'add'); - assert.strictEqual(funcItem.returns, 'void'); + assert.strictEqual(funcItem.returns, undefined); assert.strictEqual(funcItem.parameters.length, 2); assert.strictEqual(funcItem.parameters[0].name, 'a'); assert.strictEqual(funcItem.parameters[0].type, 'Type'); @@ -350,10 +351,10 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcObjList.funcs.length, 1); let funcItem = funcObjList.funcs[0]; assert.strictEqual(funcItem.name, 'add'); - assert.strictEqual(funcItem.returns, 'void'); + assert.strictEqual(funcItem.returns, undefined); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'a'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, 'unknown'); }); @@ -369,10 +370,10 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcObjList.funcs.length, 1); let funcItem = funcObjList.funcs[0]; assert.strictEqual(funcItem.name, 'add'); - assert.strictEqual(funcItem.returns, 'void'); + assert.strictEqual(funcItem.returns, undefined); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'a'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, 'unknown'); }); @@ -388,7 +389,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcObjList.funcs.length, 1); let funcItem = funcObjList.funcs[0]; assert.strictEqual(funcItem.name, 'add'); - assert.strictEqual(funcItem.returns, 'void'); + assert.strictEqual(funcItem.returns, undefined); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'a'); assert.strictEqual(funcItem.parameters[0].type, 'Function'); @@ -407,12 +408,12 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcObjList.funcs.length, 1); let funcItem = funcObjList.funcs[0]; assert.strictEqual(funcItem.name, 'add'); - assert.strictEqual(funcItem.returns, 'void'); + assert.strictEqual(funcItem.returns, undefined); assert.strictEqual(funcItem.parameters.length, 2); assert.strictEqual(funcItem.parameters[0].name, 'n'); assert.strictEqual(funcItem.parameters[0].type, 'number'); assert.strictEqual(funcItem.parameters[1].name, 'm'); - assert.strictEqual(funcItem.parameters[1].type, 'Array'); + assert.strictEqual(funcItem.parameters[1].type, 'number[]'); }); @@ -429,10 +430,10 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcObjList.funcs.length, 1); let funcItem = funcObjList.funcs[0]; assert.strictEqual(funcItem.name, 'add'); - assert.strictEqual(funcItem.returns, 'void'); + assert.strictEqual(funcItem.returns, undefined); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, ''); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, '{ a: number; b: number; c: number }'); }); @@ -483,12 +484,12 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcObjList.funcs.length, 1); let funcItem = funcObjList.funcs[0]; assert.strictEqual(funcItem.name, 'add'); - assert.strictEqual(funcItem.returns, 'Array'); + assert.strictEqual(funcItem.returns, 'number[][]'); assert.strictEqual(funcItem.parameters.length, 2); assert.strictEqual(funcItem.parameters[0].name, 'a'); assert.strictEqual(funcItem.parameters[0].type, 'boolean'); assert.strictEqual(funcItem.parameters[1].name, 'b'); - assert.strictEqual(funcItem.parameters[1].type, 'Array'); + assert.strictEqual(funcItem.parameters[1].type, 'number[]'); }); @@ -510,7 +511,7 @@ suite('Parse_Func_TS_Suite', () => { //25, 测试 parseFunc any 和 map在一行 情况 test('parseFunc_ts_test_25', () => { - let testfunc = `function add(a: any, b: map): void {return;};` + let testfunc = `function add(a: any, b: Map): void {return;};` let funcObjList = parsets.doParseTs("test.ts", testfunc); assert.strictEqual(funcObjList.funcs.length, 1); let funcItem = funcObjList.funcs[0]; @@ -520,7 +521,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcItem.parameters[0].name, 'a'); assert.strictEqual(funcItem.parameters[0].type, 'any'); assert.strictEqual(funcItem.parameters[1].name, 'b'); - assert.strictEqual(funcItem.parameters[1].type, 'map'); + assert.strictEqual(funcItem.parameters[1].type, 'Map'); }); @@ -534,7 +535,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcItem.returns, 'void'); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'a'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, '{x:number, y:number}'); }); @@ -548,7 +549,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcItem.returns, 'void'); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'a'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, '{x:number, y?:string}'); }); @@ -562,7 +563,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcItem.returns, 'void'); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'a'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, 'number | string'); }); @@ -576,7 +577,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcItem.returns, 'void'); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'a'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, 'number | string'); }); @@ -590,7 +591,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcItem.returns, 'void'); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'a'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, '"left" | "right" | "center"'); }); @@ -604,7 +605,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcItem.returns, 'void'); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'a'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, 'string | null'); }); @@ -618,7 +619,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcItem.returns, 'void'); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'a'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, 'string | null'); }); //33, 测试 parseFunc 回调函数类型在一行 情况 @@ -631,7 +632,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcItem.returns, 'void'); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'fn'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, '(a:string) => void'); }); @@ -645,7 +646,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcItem.returns, 'void'); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'fn'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, '(a?:string) => void'); }); @@ -656,26 +657,26 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcObjList.funcs.length, 1); let funcItem = funcObjList.funcs[0]; assert.strictEqual(funcItem.name, 'add'); - assert.strictEqual(funcItem.returns, 'any'); + assert.strictEqual(funcItem.returns, 'Type | undefined'); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'fn'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, '(a:Type[]) => Type'); }); - //36, 测试 parseFunc 泛型两个参数类型在一行 情况 - test('parseFunc_ts_test_36', () => { - let testfunc = `function add(fn: (a:Input[]) => Output): Output | undefined { return Output; };` - let funcObjList = parsets.doParseTs("test.ts", testfunc); - assert.strictEqual(funcObjList.funcs.length, 1); - let funcItem = funcObjList.funcs[0]; - assert.strictEqual(funcItem.name, 'add'); - assert.strictEqual(funcItem.returns, 'any'); - assert.strictEqual(funcItem.parameters.length, 1); - assert.strictEqual(funcItem.parameters[0].name, 'fn'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + // //36, 测试 parseFunc 泛型两个参数类型在一行 情况 + // test('parseFunc_ts_test_36', () => { + // let testfunc = `function add(fn: (a:Input[]) => Output): Output | undefined { return Output; };` + // let funcObjList = parsets.doParseTs("test.ts", testfunc); + // assert.strictEqual(funcObjList.funcs.length, 1); + // let funcItem = funcObjList.funcs[0]; + // assert.strictEqual(funcItem.name, 'add'); + // assert.strictEqual(funcItem.returns, 'any'); + // assert.strictEqual(funcItem.parameters.length, 1); + // assert.strictEqual(funcItem.parameters[0].name, 'fn'); + // assert.strictEqual(funcItem.parameters[0].type, 'any'); - }); + // }); //36, 测试 parseFunc 泛型扩展类型在一行 情况 test('parseFunc_ts_test_36', () => { @@ -684,7 +685,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcObjList.funcs.length, 1); let funcItem = funcObjList.funcs[0]; assert.strictEqual(funcItem.name, 'add'); - assert.strictEqual(funcItem.returns, 'void'); + assert.strictEqual(funcItem.returns, undefined); assert.strictEqual(funcItem.parameters.length, 2); assert.strictEqual(funcItem.parameters[0].name, 'a'); assert.strictEqual(funcItem.parameters[0].type, 'Type'); @@ -699,10 +700,10 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcObjList.funcs.length, 1); let funcItem = funcObjList.funcs[0]; assert.strictEqual(funcItem.name, 'add'); - assert.strictEqual(funcItem.returns, 'void'); + assert.strictEqual(funcItem.returns, undefined); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'a'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, 'unknown'); }); @@ -713,10 +714,10 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcObjList.funcs.length, 1); let funcItem = funcObjList.funcs[0]; assert.strictEqual(funcItem.name, 'add'); - assert.strictEqual(funcItem.returns, 'void'); + assert.strictEqual(funcItem.returns, undefined); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'a'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, 'unknown'); }); @@ -727,7 +728,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcObjList.funcs.length, 1); let funcItem = funcObjList.funcs[0]; assert.strictEqual(funcItem.name, 'add'); - assert.strictEqual(funcItem.returns, 'void'); + assert.strictEqual(funcItem.returns, undefined); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'a'); assert.strictEqual(funcItem.parameters[0].type, 'Function'); @@ -741,12 +742,12 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcObjList.funcs.length, 1); let funcItem = funcObjList.funcs[0]; assert.strictEqual(funcItem.name, 'add'); - assert.strictEqual(funcItem.returns, 'void'); + assert.strictEqual(funcItem.returns, undefined); assert.strictEqual(funcItem.parameters.length, 2); assert.strictEqual(funcItem.parameters[0].name, 'n'); assert.strictEqual(funcItem.parameters[0].type, 'number'); assert.strictEqual(funcItem.parameters[1].name, 'm'); - assert.strictEqual(funcItem.parameters[1].type, 'Array'); + assert.strictEqual(funcItem.parameters[1].type, 'number[]'); }); @@ -758,10 +759,10 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcObjList.funcs.length, 1); let funcItem = funcObjList.funcs[0]; assert.strictEqual(funcItem.name, 'add'); - assert.strictEqual(funcItem.returns, 'void'); + assert.strictEqual(funcItem.returns, undefined); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, ''); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, '{ a: number; b: number; c: number }'); }); @@ -792,7 +793,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcObjList.funcs.length, 1); let funcItem = funcObjList.funcs[0]; assert.strictEqual(funcItem.name, 'add'); - assert.strictEqual(funcItem.returns, 'void'); + assert.strictEqual(funcItem.returns, undefined); }); @@ -808,12 +809,12 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcObjList.funcs.length, 1); let funcItem = funcObjList.funcs[0]; assert.strictEqual(funcItem.name, 'add'); - assert.strictEqual(funcItem.returns, 'any'); + assert.strictEqual(funcItem.returns, 'number[[]'); assert.strictEqual(funcItem.parameters.length, 2); assert.strictEqual(funcItem.parameters[0].name, 'a'); assert.strictEqual(funcItem.parameters[0].type, 'boolean'); assert.strictEqual(funcItem.parameters[1].name, 'b'); - assert.strictEqual(funcItem.parameters[1].type, 'Array'); + assert.strictEqual(funcItem.parameters[1].type, 'number['); }); @@ -829,7 +830,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcObjList.funcs.length, 1); let funcItem = funcObjList.funcs[0]; assert.strictEqual(funcItem.name, 'add'); - assert.strictEqual(funcItem.returns, 'any'); + assert.strictEqual(funcItem.returns, '{'); assert.strictEqual(funcItem.parameters.length, 2); assert.strictEqual(funcItem.parameters[0].name, 'a'); assert.strictEqual(funcItem.parameters[0].type, 'String'); @@ -874,9 +875,9 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcItem.returns, 'void'); assert.strictEqual(funcItem.parameters.length, 2); assert.strictEqual(funcItem.parameters[0].name, ''); - assert.strictEqual(funcItem.parameters[0].type, 'void'); + assert.strictEqual(funcItem.parameters[0].type, undefined); assert.strictEqual(funcItem.parameters[1].name, 'a'); - assert.strictEqual(funcItem.parameters[1].type, 'any'); + assert.strictEqual(funcItem.parameters[1].type, '{x:number, y:number}'); }); //56, 测试 parseFunc 声明可选属性类型 情况 @@ -894,7 +895,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcItem.returns, 'void'); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'a'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, '{x:number, y?:string}'); }); @@ -913,7 +914,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcItem.returns, 'void'); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'a'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, 'number | string'); }); @@ -932,7 +933,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcItem.returns, 'void'); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'a'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, 'number | string'); }); @@ -953,9 +954,9 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcItem.parameters[0].name, 'a'); assert.strictEqual(funcItem.parameters[0].type, 'B'); assert.strictEqual(funcItem.parameters[1].name, 'extend'); - assert.strictEqual(funcItem.parameters[1].type, 'void'); + assert.strictEqual(funcItem.parameters[1].type, undefined); assert.strictEqual(funcItem.parameters[2].name, 'string'); - assert.strictEqual(funcItem.parameters[2].type, 'void'); + assert.strictEqual(funcItem.parameters[2].type, undefined); }); //60, 测试 parseFunc null 参数类型 情况 @@ -973,7 +974,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcItem.returns, 'void'); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, ''); - assert.strictEqual(funcItem.parameters[0].type, 'void'); + assert.strictEqual(funcItem.parameters[0].type, undefined); }); @@ -992,7 +993,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcItem.returns, 'void'); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'a'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, 'string | null'); }); @@ -1011,7 +1012,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcItem.returns, 'void'); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, '中文'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, '(a:string) => void'); }); @@ -1030,7 +1031,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcItem.returns, 'void'); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'fn'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, '(a?:中文参数) => void'); }); @@ -1046,10 +1047,10 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcObjList.funcs.length, 1); let funcItem = funcObjList.funcs[0]; assert.strictEqual(funcItem.name, 'add'); - assert.strictEqual(funcItem.returns, 'any'); + assert.strictEqual(funcItem.returns, '中文泛型 | undefined'); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'fn'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, '(a:中文泛型[]) => 中文泛型'); }); @@ -1065,10 +1066,10 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcObjList.funcs.length, 1); let funcItem = funcObjList.funcs[0]; assert.strictEqual(funcItem.name, 'add'); - assert.strictEqual(funcItem.returns, 'any'); + assert.strictEqual(funcItem.returns, '| undefined'); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'fn'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, '(a:Input[]) =>'); }); @@ -1084,7 +1085,7 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcObjList.funcs.length, 1); let funcItem = funcObjList.funcs[0]; assert.strictEqual(funcItem.name, 'add'); - assert.strictEqual(funcItem.returns, 'void'); + assert.strictEqual(funcItem.returns, undefined); assert.strictEqual(funcItem.parameters.length, 2); assert.strictEqual(funcItem.parameters[0].name, 'a'); assert.strictEqual(funcItem.parameters[0].type, 'Type'); @@ -1104,10 +1105,10 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcObjList.funcs.length, 1); let funcItem = funcObjList.funcs[0]; assert.strictEqual(funcItem.name, 'add'); - assert.strictEqual(funcItem.returns, 'void'); + assert.strictEqual(funcItem.returns, undefined); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'a'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, 'typeof globalThis'); }); @@ -1123,10 +1124,10 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcObjList.funcs.length, 1); let funcItem = funcObjList.funcs[0]; assert.strictEqual(funcItem.name, 'add'); - assert.strictEqual(funcItem.returns, 'void'); + assert.strictEqual(funcItem.returns, undefined); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, 'a'); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, 'unknown & null'); }); @@ -1142,10 +1143,10 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcObjList.funcs.length, 1); let funcItem = funcObjList.funcs[0]; assert.strictEqual(funcItem.name, 'add'); - assert.strictEqual(funcItem.returns, 'void'); + assert.strictEqual(funcItem.returns, undefined); assert.strictEqual(funcItem.parameters.length, 1); assert.strictEqual(funcItem.parameters[0].name, ''); - assert.strictEqual(funcItem.parameters[0].type, 'any'); + assert.strictEqual(funcItem.parameters[0].type, '[number, number]'); }); @@ -1161,12 +1162,12 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcObjList.funcs.length, 1); let funcItem = funcObjList.funcs[0]; assert.strictEqual(funcItem.name, 'add'); - assert.strictEqual(funcItem.returns, 'void'); + assert.strictEqual(funcItem.returns, undefined); assert.strictEqual(funcItem.parameters.length, 2); assert.strictEqual(funcItem.parameters[0].name, 'n'); assert.strictEqual(funcItem.parameters[0].type, 'number'); assert.strictEqual(funcItem.parameters[1].name, 'm'); - assert.strictEqual(funcItem.parameters[1].type, 'Array'); + assert.strictEqual(funcItem.parameters[1].type, '数组[]'); }); @@ -1183,16 +1184,16 @@ suite('Parse_Func_TS_Suite', () => { assert.strictEqual(funcObjList.funcs.length, 1); let funcItem = funcObjList.funcs[0]; assert.strictEqual(funcItem.name, 'add'); - assert.strictEqual(funcItem.returns, 'void'); + assert.strictEqual(funcItem.returns, undefined); assert.strictEqual(funcItem.parameters.length, 4); assert.strictEqual(funcItem.parameters[0].name, ''); - assert.strictEqual(funcItem.parameters[0].type, 'void'); + assert.strictEqual(funcItem.parameters[0].type, undefined); assert.strictEqual(funcItem.parameters[1].name, ''); - assert.strictEqual(funcItem.parameters[1].type, 'void'); + assert.strictEqual(funcItem.parameters[1].type, undefined); assert.strictEqual(funcItem.parameters[2].name, ''); - assert.strictEqual(funcItem.parameters[2].type, 'void'); + assert.strictEqual(funcItem.parameters[2].type, undefined); assert.strictEqual(funcItem.parameters[3].name, ''); - assert.strictEqual(funcItem.parameters[3].type, 'void'); + assert.strictEqual(funcItem.parameters[3].type, undefined); }); //72, 测试 parseFunc 函数名带下划线 类型 情况 diff --git a/src/vscode_plugin/src/test/suite/parse/parsetstype.test.ts b/src/vscode_plugin/src/test/suite/parse/parsetstype.test.ts index 6e18008e..ec4901a0 100644 --- a/src/vscode_plugin/src/test/suite/parse/parsetstype.test.ts +++ b/src/vscode_plugin/src/test/suite/parse/parsetstype.test.ts @@ -88,12 +88,30 @@ suite('Parse_Type_TS_Suite', () => { lbfundef: (a: boolean[])=> boolean[]; lafundef: (a: any[])=> any[]; ltfundef: (a: tstruct[])=> tstruct[]; + mapstrfundef: (am: Map)=> Map; + mapnumfundef: (am: Map)=> Map; + mapboolfundef: (am: Map)=> Map; + arraynumfundef: (am: Array)=> Array; + arraystrfundef: (am: Array)=> Array; + arrayboolfundef: (am: Array)=> Array; + setnumfundef: (am: Set)=> Set; + setstrfundef: (am: Set)=> Set; + setboolfundef: (am: Set)=> Set; + mapstr: Map; + mapnum: Map; + mapbool: Map; + arraystr: Array; + arraynum: Array; + arraybool: Array; + setstr: Set; + setnum: Set; + setbool: Set; };` let typeObjList = parsets.doParseTs("test.ts", testtype); assert.strictEqual(typeObjList.types?.length, 1); let typeItem = typeObjList.types[0]; assert.strictEqual(typeItem.name, 'OTC'); - assert.strictEqual(typeItem.members.length, 22); + assert.strictEqual(typeItem.members.length, 40); assert.strictEqual(typeItem.members[0].name, 'len'); assert.strictEqual(typeItem.members[0].type, 'number'); assert.strictEqual(typeItem.members[1].name, 'name'); @@ -138,6 +156,42 @@ suite('Parse_Type_TS_Suite', () => { assert.strictEqual(typeItem.members[20].type, '(a: any[])=> any[]'); assert.strictEqual(typeItem.members[21].name, 'ltfundef'); assert.strictEqual(typeItem.members[21].type, '(a: tstruct[])=> tstruct[]'); + assert.strictEqual(typeItem.members[22].name, 'mapstrfundef'); + assert.strictEqual(typeItem.members[22].type, '(am: Map)=> Map'); + assert.strictEqual(typeItem.members[23].name, 'mapnumfundef'); + assert.strictEqual(typeItem.members[23].type, '(am: Map)=> Map'); + assert.strictEqual(typeItem.members[24].name, 'mapboolfundef'); + assert.strictEqual(typeItem.members[24].type, '(am: Map)=> Map'); + assert.strictEqual(typeItem.members[25].name, 'arraynumfundef'); + assert.strictEqual(typeItem.members[25].type, '(am: Array)=> Array'); + assert.strictEqual(typeItem.members[26].name, 'arraystrfundef'); + assert.strictEqual(typeItem.members[26].type, '(am: Array)=> Array'); + assert.strictEqual(typeItem.members[27].name, 'arrayboolfundef'); + assert.strictEqual(typeItem.members[27].type, '(am: Array)=> Array'); + assert.strictEqual(typeItem.members[28].name, 'setnumfundef'); + assert.strictEqual(typeItem.members[28].type, '(am: Set)=> Set'); + assert.strictEqual(typeItem.members[29].name, 'setstrfundef'); + assert.strictEqual(typeItem.members[29].type, '(am: Set)=> Set'); + assert.strictEqual(typeItem.members[30].name, 'setboolfundef'); + assert.strictEqual(typeItem.members[30].type, '(am: Set)=> Set'); + assert.strictEqual(typeItem.members[31].name, 'mapstr'); + assert.strictEqual(typeItem.members[31].type, 'Map'); + assert.strictEqual(typeItem.members[32].name, 'mapnum'); + assert.strictEqual(typeItem.members[32].type, 'Map'); + assert.strictEqual(typeItem.members[33].name, 'mapbool'); + assert.strictEqual(typeItem.members[33].type, 'Map'); + assert.strictEqual(typeItem.members[34].name, 'arraystr'); + assert.strictEqual(typeItem.members[34].type, 'Array'); + assert.strictEqual(typeItem.members[35].name, 'arraynum'); + assert.strictEqual(typeItem.members[35].type, 'Array'); + assert.strictEqual(typeItem.members[36].name, 'arraybool'); + assert.strictEqual(typeItem.members[36].type, 'Array'); + assert.strictEqual(typeItem.members[37].name, 'setstr'); + assert.strictEqual(typeItem.members[37].type, 'Set'); + assert.strictEqual(typeItem.members[38].name, 'setnum'); + assert.strictEqual(typeItem.members[38].type, 'Set'); + assert.strictEqual(typeItem.members[39].name, 'setbool'); + assert.strictEqual(typeItem.members[39].type, 'Set'); assert.strictEqual(typeItem.functions.length, 12); assert.strictEqual(typeItem.functions[0].name, 'deconstruct'); -- Gitee