(t *testing.T)
| 40 | } |
| 41 | |
| 42 | func TestExtractPythonName(t *testing.T) { |
| 43 | for _, tt := range []struct { |
| 44 | name string |
| 45 | goDoc string |
| 46 | newName string |
| 47 | newGoDoc string |
| 48 | err error |
| 49 | }{ |
| 50 | {"Func1", "", "Func1", "", nil}, |
| 51 | {"Func2", "\ngopy:name func2\n", "func2", "\n", nil}, |
| 52 | {"Func3", "\ngopy:name bad name\n", "", "", errors.New("gopy: invalid identifier: bad name")}, |
| 53 | {"Func4", "\nsome comment\n", "Func4", "\nsome comment\n", nil}, |
| 54 | {"Func5", "\nsome comment\ngopy:name func5\n", "func5", "\nsome comment\n", nil}, |
| 55 | {"Func6", "\nsome comment\ngopy:name __len__\n", "__len__", "\nsome comment\n", nil}, |
| 56 | } { |
| 57 | newName, newGoDoc, err := extractPythonName(tt.name, tt.goDoc) |
| 58 | |
| 59 | if newName != tt.newName { |
| 60 | t.Errorf("extractPythonName(%s, %s): expected name %s, actual %s", tt.name, tt.goDoc, tt.newName, newName) |
| 61 | } |
| 62 | |
| 63 | if newGoDoc != tt.newGoDoc { |
| 64 | t.Errorf("extractPythonName(%s, %s): expected comment %s, actual %s", tt.name, tt.goDoc, tt.newGoDoc, newGoDoc) |
| 65 | } |
| 66 | |
| 67 | if err != nil && err.Error() != tt.err.Error() { |
| 68 | t.Errorf("extractPythonName(%s, %s): expected err %s, actual %s", tt.name, tt.goDoc, tt.err, err) |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | func TestPythonConfig(t *testing.T) { |
| 74 | t.Skip() |
nothing calls this directly
no test coverage detected