Skip to content

Commit

Permalink
add unit test
Browse files Browse the repository at this point in the history
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
  • Loading branch information
AkashKumar7902 committed Feb 19, 2024
1 parent 4cc8128 commit 0bb5900
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion pkg/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"kcl-lang.io/kpm/pkg/git"
"kcl-lang.io/kpm/pkg/opt"
pkg "kcl-lang.io/kpm/pkg/package"
"kcl-lang.io/kpm/pkg/reporter"

Check failure on line 22 in pkg/client/client_test.go

View workflow job for this annotation

GitHub Actions / Lint checks

imported and not used: "kcl-lang.io/kpm/pkg/reporter" (typecheck)
"kcl-lang.io/kpm/pkg/runner"
"kcl-lang.io/kpm/pkg/utils"
)
Expand Down Expand Up @@ -158,7 +159,31 @@ func TestDependencyGraph(t *testing.T) {
}

func TestCyclicDependency(t *testing.T) {

// testDir := getTestDir("test_cyclic_dependency")
// assert.Equal(t, utils.DirExists(filepath.Join(testDir, "aaa")), true)
// assert.Equal(t, utils.DirExists(filepath.Join(testDir, "aaa/kcl.mod")), true)
// assert.Equal(t, utils.DirExists(filepath.Join(testDir, "bbb")), true)
// assert.Equal(t, utils.DirExists(filepath.Join(testDir, "bbb/kcl.mod")), true)

// pkg_path := filepath.Join(testDir, "aaa")

// kpmcli, err := NewKpmClient()
// assert.Equal(t, err, nil)
// kclPkg, err := kpmcli.LoadPkgFromPath(pkg_path)
// assert.Equal(t, err, nil)

// currentDir, err := os.Getwd()
// assert.Equal(t, err, nil)
// err = os.Chdir(pkg_path)
// assert.Equal(t, err, nil)

// _, _, err = kpmcli.InitGraphAndDownloadDeps(kclPkg)
// assert.Equal(t, err, reporter.NewErrorEvent(
// reporter.CircularDependencyExist, nil, "adding dependencies results in a cycle",
// ))

// err = os.Chdir(currentDir)
// assert.Equal(t, err, nil)
}

func TestInitEmptyPkg(t *testing.T) {
Expand Down

0 comments on commit 0bb5900

Please sign in to comment.