Skip to content

Commit a4bb031

Browse files
committed
patch2: fix some comments and nit
1 parent eb24842 commit a4bb031

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

go/callgraph/rta/rta_test.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ var baseConfig = &packages.Config{
3838
packages.NeedTypes,
3939
}
4040

41-
// TestRTASingleFile runs RTA on each testdata/*.go file and compares the
42-
// results with the expectations expressed in the WANT comment.
41+
// TestRTASingleFile runs RTA on each testdata/*.txtar file containing a single
42+
// go file and compares the results with the expectations expressed in the WANT
43+
// comment.
4344
func TestRTASingleFile(t *testing.T) {
4445
archivePaths := []string{
4546
"testdata/func.txtar",
@@ -73,7 +74,7 @@ func TestRTASingleFile(t *testing.T) {
7374
}
7475

7576
// TestRTAOnPackages runs RTA on a go module which contains multiple packages to test the case
76-
// that the interface definition and its implementations locate in different packages.
77+
// when an interface has implementations across different packages.
7778
func TestRTAOnPackages(t *testing.T) {
7879
baseConfig.Dir = restoreArchive(t, "testdata/multipkgs.txtar")
7980
pkgs, err := packages.Load(baseConfig, "./...")
@@ -83,9 +84,8 @@ func TestRTAOnPackages(t *testing.T) {
8384

8485
var f *ast.File
8586
for _, p := range pkgs {
86-
// we retrieve first file inside main package as the expected result stays there
87-
// this implies the main package should only have one file or the expected result is stored
88-
// in the first file of main package
87+
// We assume the packages have a single file or
88+
// the wanted result is in the first file of the main package.
8989
if p.Name == "main" {
9090
f = p.Syntax[0]
9191
}
@@ -110,8 +110,8 @@ func TestRTAOnPackages(t *testing.T) {
110110
}
111111

112112
// restoreArchive restores a go module from the archive file,
113-
// and put all contents in a temporary folder
114-
func restoreArchive(t *testing.T, achieveFilePath string) (dir string) {
113+
// and puts all contents in a temporary folder.
114+
func restoreArchive(t *testing.T, achieveFilePath string) string {
115115
ar, err := txtar.ParseFile(achieveFilePath)
116116
if err != nil {
117117
t.Fatal(err)
@@ -121,8 +121,7 @@ func restoreArchive(t *testing.T, achieveFilePath string) (dir string) {
121121
if err != nil {
122122
t.Fatal(err)
123123
}
124-
dir = testfiles.CopyToTmp(t, fs)
125-
return
124+
return testfiles.CopyToTmp(t, fs)
126125
}
127126

128127
// check tests the RTA analysis results against the test expectations

0 commit comments

Comments
 (0)