def generateFuncUsageByLineContentGo(lineContent): # get func parts: (caller, method, args, returnParams) = g.getGoFuncDeclarationPartsByLineContent(lineContent) returnParamsSplitedList = g.splitArgs(returnParams) color.red("returnParamsSplitedList") print(returnParamsSplitedList) # split args argsSplitedList = g.splitArgs(args) # get vars commas str (_, varsCommasStr, _) = g.getVarBlockByStructureListOfNameTypeName(argsSplitedList) # get return params comma string (_, returnParamsCommasStr, _) = g.getVarBlockByStructureListOfNameTypeName(returnParamsSplitedList) callerVarName = g.getCallerVarName(caller) funcCall = g.innerTestFuncPartGoTestPrepare_callTestableFunc(callerVarName, method, returnParamsCommasStr, varsCommasStr) # get var block and add before funcCall (varBlock, _, _) = getVarBlock(caller, args, returnParams) # func usage total funcUsageTotal = "/*{}*/\n{}".format(varBlock, funcCall) return funcUsageTotal
def test_testName(self): color.blue("test here baby") (caller, methodName, returnArgsCommaStr, varsCommasStr) = ("caller", "methodName", "res1,res2", "var1,var2,var3") result = generateTestFileNameForGoTest.innerTestFuncPartGoTestPrepare_callTestableFunc(caller, methodName, returnArgsCommaStr, varsCommasStr) expected = "res1,res2 = caller.methodName(var1,var2,var3)" assertMy.equals(result, expected)