Skip to content

Commit

Permalink
test: fix move class test
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Dec 29, 2019
1 parent a05ecc4 commit 453ea3c
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 11 deletions.
1 change: 1 addition & 0 deletions _fixtures/refactor/move.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
move.a.ImportForB -> move.a.ImportForB
5 changes: 0 additions & 5 deletions _fixtures/refactor/move/a/ImportForB.java
Original file line number Diff line number Diff line change
@@ -1,5 +0,0 @@
package move.a;

public class ImportForB {

}
Empty file.
6 changes: 2 additions & 4 deletions core/domain/refactor/move_class/move_class_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,12 @@ func parseRename() {

copyClass(originFile, newFile)

updatePackageInfo(nodes, originImport, newImport)

updatePackageInfo(originImport, newImport)
updateImportSide(originImport, newImport)
}
}

func updatePackageInfo(structs []models2.JMoveStruct, originImport string, newImport string) {
func updatePackageInfo(originImport string, newImport string) {
var originNode models2.JMoveStruct
for index := range nodes {
node := nodes[index]
Expand All @@ -99,7 +98,6 @@ func updatePackageInfo(structs []models2.JMoveStruct, originImport string, newIm
path := buildJavaPath(configPath + newImport)
split := strings.Split(newImport, ".")
pkg := strings.Join(split[:len(split)-1], ".")
fmt.Println(pkg)
updateFile(path, originNode.GetPkgInfo().StartLine, "package "+pkg+";")
}

Expand Down
4 changes: 2 additions & 2 deletions core/domain/refactor/move_class/move_class_app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
func TestNewMoveClassApp(t *testing.T) {
g := NewGomegaWithT(t)

config := "../../../../_fixtures/refactor/move/move.config"
path := "../../../../_fixtures/refactor/move/"
config := "../../../../_fixtures/refactor/move.config"
path := "../../../../_fixtures/refactor/"
app := NewMoveClassApp(config, path)
app.Analysis()

Expand Down

0 comments on commit 453ea3c

Please sign in to comment.