Skip to content

Commit

Permalink
fix elvish test
Browse files Browse the repository at this point in the history
  • Loading branch information
Mic92 committed Aug 13, 2023
1 parent 1b8671f commit 307ab4d
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions test/direnv-test.elv
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

use path

E:TEST_DIR = (path:dir (src)[name])
set E:TEST_DIR = (path:dir (src)[name])
set-env XDG_CONFIG_HOME $E:TEST_DIR/config
set-env XDG_DATA_HOME $E:TEST_DIR/data
E:PATH = (path:dir $E:TEST_DIR):$E:PATH
set E:PATH = (path:dir $E:TEST_DIR):$E:PATH

cd $E:TEST_DIR

Expand All @@ -22,15 +22,16 @@ touch $E:XDG_CONFIG_HOME/direnv/direnvrc

fn direnv-eval {
try {
m = (direnv export elvish | from-json)
keys $m | each [k]{
var m = (direnv export elvish | from-json)
var k
keys $m | each {|k|
if $m[$k] {
set-env $k $m[$k]
} else {
unset-env $k
}
}
} except e {
} catch e {
nop
}
}
Expand All @@ -41,19 +42,19 @@ fn test-debug {
}
}

fn test-eq [a b]{
fn test-eq {|a b|
if (!=s $a $b) {
fail "FAILED: '"$a"' == '"$b"'"
}
}

fn test-neq [a b]{
fn test-neq {|a b|
if (==s $a $b) {
fail "FAILED: '"$a"' != '"$b"'"
}
}

fn test-scenario [name fct]{
fn test-scenario {|name fct|
cd $E:TEST_DIR/scenarios/$name
direnv allow
test-debug
Expand All @@ -71,7 +72,7 @@ fn test-scenario [name fct]{

try {
direnv allow
} except e {
} catch e {
nop
}

Expand Down

0 comments on commit 307ab4d

Please sign in to comment.