-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from asdf-vm/tb/remove-command-bats
feat(golang-rewrite): more `asdf plugin remove` tests
- Loading branch information
Showing
8 changed files
with
150 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Package data provides constants and functions pertaining to directories and | ||
// files in the asdf data directory on disk, specified by the $ASDF_DATA_DIR | ||
package data | ||
|
||
import ( | ||
"path/filepath" | ||
) | ||
|
||
const ( | ||
dataDirDownloads = "downloads" | ||
dataDirInstalls = "installs" | ||
dataDirPlugins = "plugins" | ||
) | ||
|
||
// DownloadDirectory returns the directory a plugin will be placing | ||
// downloads of version source code | ||
func DownloadDirectory(dataDir, pluginName string) string { | ||
return filepath.Join(dataDir, dataDirDownloads, pluginName) | ||
} | ||
|
||
// InstallDirectory returns the path to a plugin directory | ||
func InstallDirectory(dataDir, pluginName string) string { | ||
return filepath.Join(dataDir, dataDirInstalls, pluginName) | ||
} | ||
|
||
// PluginsDirectory returns the path to the plugins directory in the data dir | ||
func PluginsDirectory(dataDir string) string { | ||
return filepath.Join(dataDir, dataDirPlugins) | ||
} | ||
|
||
// PluginDirectory returns the directory a plugin with a given name would be in | ||
// if it were installed | ||
func PluginDirectory(dataDir, pluginName string) string { | ||
return filepath.Join(dataDir, dataDirPlugins, pluginName) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package data | ||
|
||
import "testing" | ||
|
||
const testPluginName = "lua" | ||
|
||
func TestPluginDirectory(t *testing.T) { | ||
t.Run("returns new path with plugin name as last segment", func(t *testing.T) { | ||
pluginDir := PluginDirectory("~/.asdf/", testPluginName) | ||
expected := "~/.asdf/plugins/lua" | ||
if pluginDir != expected { | ||
t.Errorf("got %v, expected %v", pluginDir, expected) | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.