Skip to content

Commit

Permalink
#12: adjust test
Browse files Browse the repository at this point in the history
  • Loading branch information
kcmvp committed Dec 17, 2023
1 parent 270a9c1 commit 5d228eb
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions cmd/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import (

var v6 = "github.com/ofabry/go-callvis@v0.6.1"
var v7 = "github.com/ofabry/go-callvis@v0.7.0"
var golanglint = "github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2"

//var golanglint = "github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2"

func TestInstallPlugin(t *testing.T) {
internal.CurProject().LoadSettings()
Expand Down Expand Up @@ -58,19 +59,19 @@ func TestInstallPlugin(t *testing.T) {
assert.Equal(t, "run7", plugin.C)
assert.Equal(t, v7, plugin.D)

// install another plugin
rootCmd.SetArgs([]string{"plugin", "install", golanglint, "-a=lint", "-c=lint-run"})
err = rootCmd.Execute()
assert.NoError(t, err)
rootCmd.SetArgs([]string{"plugin"})
err = rootCmd.Execute()
assert.NoError(t, err)
plugin, ok = lo.Find(internal.CurProject().Plugins(), func(item lo.Tuple4[string, string, string, string]) bool {
return item.D == golanglint
})
assert.Equal(t, "golangci-lint", plugin.A)
assert.Equal(t, "lint", plugin.B)
assert.Equal(t, "lint-run", plugin.C)
assert.Equal(t, golanglint, plugin.D)
assert.Equal(t, 2, len(internal.CurProject().Plugins()))
//// install another plugin
//rootCmd.SetArgs([]string{"plugin", "install", golanglint, "-a=lint", "-c=lint-run"})
//err = rootCmd.Execute()
//assert.NoError(t, err)
//rootCmd.SetArgs([]string{"plugin"})
//err = rootCmd.Execute()
//assert.NoError(t, err)
//plugin, ok = lo.Find(internal.CurProject().Plugins(), func(item lo.Tuple4[string, string, string, string]) bool {
// return item.D == golanglint
//})
//assert.Equal(t, "golangci-lint", plugin.A)
//assert.Equal(t, "lint", plugin.B)
//assert.Equal(t, "lint-run", plugin.C)
//assert.Equal(t, golanglint, plugin.D)
//assert.Equal(t, 2, len(internal.CurProject().Plugins()))
}

0 comments on commit 5d228eb

Please sign in to comment.