Skip to content

Commit

Permalink
rename pkgName to pkgPath
Browse files Browse the repository at this point in the history
  • Loading branch information
tbruyelle committed Jul 4, 2023
1 parent efa19d1 commit b90c4fb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion gnovm/cmd/gno/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func execBuild(cfg *buildCfg, args []string, io *commands.IO) error {
return flag.ErrHelp
}

paths, err := gnoPackagePathsFromArgs(args)
paths, err := gnoPackagesFromArgs(args)
if err != nil {
return fmt.Errorf("list packages: %w", err)
}
Expand Down
13 changes: 6 additions & 7 deletions gnovm/cmd/gno/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func execTest(cfg *testCfg, args []string, io *commands.IO) error {
cfg.rootDir = guessRootDir()
}

pkgPaths, err := gnoPackagePathsFromArgs(args)
pkgPaths, err := gnoPackagesFromArgs(args)
if err != nil {
return fmt.Errorf("list packages from args: %w", err)
}
Expand Down Expand Up @@ -226,7 +226,7 @@ func execTest(cfg *testCfg, args []string, io *commands.IO) error {
}

func gnoTestPkg(
pkgPath string,
pkgDir string,
unittestFiles,
filetestFiles []string,
cfg *testCfg,
Expand Down Expand Up @@ -266,16 +266,15 @@ func gnoTestPkg(

// testing with *_test.gno
if len(unittestFiles) > 0 {
// TODO not pkgName, bc it's usually the last part of the pkgPath
pkgName := strings.TrimPrefix(pkgPath, "./examples/")
memPkg := gno.ReadMemPackage(pkgPath, pkgName)
pkgPath := strings.TrimPrefix(pkgDir, "./examples/")
memPkg := gno.ReadMemPackage(pkgDir, pkgPath)

// tfiles, ifiles := gno.ParseMemPackageTests(memPkg)
tfiles, ifiles := parseMemPackageTests(memPkg)

// run test files in pkg
{
m := tests.TestMachine(testStore, stdout, pkgName)
m := tests.TestMachine(testStore, stdout, pkgPath)
if printRuntimeMetrics {
// from tm2/pkg/sdk/vm/keeper.go
// XXX: make maxAllocTx configurable.
Expand Down Expand Up @@ -324,7 +323,7 @@ func gnoTestPkg(
closer = testutils.CaptureStdoutAndStderr()
}

testFilePath := filepath.Join(pkgPath, testFileName)
testFilePath := filepath.Join(pkgDir, testFileName)
err := tests.RunFileTest(rootDir, testFilePath, tests.WithSyncWanted(cfg.updateGoldenTests))
duration := time.Since(startedAt)
dstr := fmtDuration(duration)
Expand Down
2 changes: 1 addition & 1 deletion gnovm/cmd/gno/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func gnoFilesFromArgs(args []string) ([]string, error) {
return paths, nil
}

func gnoPackagePathsFromArgs(args []string) ([]string, error) {
func gnoPackagesFromArgs(args []string) ([]string, error) {
paths := []string{}
for _, arg := range args {
info, err := os.Stat(arg)
Expand Down

0 comments on commit b90c4fb

Please sign in to comment.