Add tests
This commit is contained in:
33
tests/test_direnv_stable_behavior
Normal file
33
tests/test_direnv_stable_behavior
Normal file
@@ -0,0 +1,33 @@
|
||||
# -*- mode: sh -*-
|
||||
|
||||
function initDirenv {
|
||||
# direnv needs a writable home:
|
||||
run "export HOME=$(pwd)"
|
||||
run 'eval "$(direnv hook bash)"'
|
||||
}
|
||||
|
||||
function test_simpleEnvrcWorks {
|
||||
initDirenv
|
||||
|
||||
writeFile .envrc <<EOF
|
||||
export FOO=bar
|
||||
EOF
|
||||
run "direnv allow"
|
||||
assert "$(getEnv FOO)" == bar
|
||||
}
|
||||
|
||||
function test_direnvExecRunsInCleanEnv {
|
||||
initDirenv
|
||||
|
||||
run "export FOO=baz"
|
||||
|
||||
writeFile .envrc <<EOF
|
||||
export FOO=bar
|
||||
EOF
|
||||
|
||||
run "direnv allow"
|
||||
assert "$(getEnv FOO)" == bar
|
||||
#captureShell 'echo $FOO'
|
||||
#captureShell 'direnv exec /proc env | grep FOO'
|
||||
assert "$(captureShell 'direnv exec /proc env | grep FOO')" == "FOO=baz"
|
||||
}
|
||||
Reference in New Issue
Block a user