Skip to content

Commit

Permalink
feat(golang-rewrite): improve execenv.Generate tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Stratus3D committed Nov 27, 2024
1 parent 25dadec commit 1210795
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions internal/execenv/execenv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ func TestGenerate(t *testing.T) {
_, err := repotest.InstallPlugin("dummy_plugin", testDataDir, testPluginName)
assert.Nil(t, err)
plugin := plugins.New(conf, testPluginName)
assert.Nil(t, repotest.WritePluginCallback(plugin.Dir, "exec-env", "#!/usr/bin/env bash\nexport FOO=bar"))
env, err := Generate(plugin, map[string]string{})
assert.Nil(t, repotest.WritePluginCallback(plugin.Dir, "exec-env", "#!/usr/bin/env bash\nexport BAZ=bar"))
env, err := Generate(plugin, map[string]string{"ASDF_INSTALL_VERSION": "test"})
assert.Nil(t, err)
assert.Equal(t, "bar", env["FOO"])
assert.Equal(t, "bar", env["BAZ"])
assert.Equal(t, "test", env["ASDF_INSTALL_VERSION"])
})

t.Run("returns error when plugin lacks exec-env callback", func(t *testing.T) {
Expand Down

0 comments on commit 1210795

Please sign in to comment.