Add tests

This commit is contained in:
2019-12-03 20:43:28 +01:00
parent f6fc817e84
commit 0976f04505
5 changed files with 57 additions and 4 deletions

View 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"
}