def test_testName(self): color.blue("test here baby") filename = os.path.dirname(os.path.realpath(__file__)) + "/poligion/poligon.go" position = 56 expected = os.path.dirname(os.path.realpath(__file__)) + "/poligion/Test_doAllForMiByUrl_test.go" if os.path.isfile(expected): os.remove(expected) result = generateTestFileNameForGoTest.createFromPosition(filename, position) testFileContent = filer2.read(result) expectedText = """package elit import ( "my" "testing" ) func Test_doAllForMiByUrl(t *testing.T) { var ( url string expected menuItem t *testing.T ) doAllForMiByUrl(url,expected,t) }""" assertMy.equals(result, expected) assertMy.equals(testFileContent, expectedText)
def run(self): view = self.window.active_view() filename = view.file_name() view = self.window.active_view() region1 = view.sel()[0] position = region1.a testFile = generateTestFileNameForGoTest.createFromPosition(filename, position) self.window.open_file(testFile)
def test_testName(self): color.blue("test here baby") filename = os.path.dirname(os.path.realpath(__file__)) + "/poligion/poligonRealFromRunly.go" position = 461 expected = os.path.dirname(os.path.realpath(__file__)) + "/poligion/Test_searchYoutubeByYoutubeId_test.go" if os.path.isfile(expected): os.remove(expected) result = generateTestFileNameForGoTest.createFromPosition(filename, position) testFileContent = filer2.read(result) expectedText = """package db import ( "my" "testing" ) func Test_searchYoutubeByYoutubeId(t *testing.T) { var ( youtubeId string onlyOne *YoutubeSearchResult onlyOne_expected *YoutubeSearchResult ) onlyOne = searchYoutubeByYoutubeId(youtubeId) expectedJson_onlyOne := `` my.FromJson(expectedJson_onlyOne, &onlyOne_expected) my.Test(onlyOne, onlyOne_expected, t) }""" assertMy.equals(result, expected) assertMy.equals(testFileContent, expectedText)