def test_testName(self): color.blue("test here baby") (caller, method, args, returnParams) = generateTestFileNameForGoTest.getGoFuncDeclarationPartsByLineContent("func (caller *CallerType) LocalsByYoutubeId(ds *mon.DataStore, youtubeId string) *int {") assertMy.equals(caller, "caller *CallerType") assertMy.equals(method, "LocalsByYoutubeId") assertMy.equals(args, "ds *mon.DataStore, youtubeId string") assertMy.equals(returnParams, "")
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, method, args, returnParams) = generateTestFileNameForGoTest.getGoFuncDeclarationPartsByLineContent( "func OneTwoFiftyTwoAnchors() (html template.HTML) {" ) assertMy.equals(caller, "") assertMy.equals(method, "OneTwoFiftyTwoAnchors") assertMy.equals(args, "") assertMy.equals(returnParams, "html template.HTML")