forked from NixOS/nix
-
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.
Functional Test for
builtins.storeDir
and builtins.currentSystem
These were under-tested. This tests the status quo and especially previous commit of this PR better.
- Loading branch information
1 parent
bcbdb09
commit 70f50cb
Showing
2 changed files
with
36 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
source common.sh | ||
|
||
export REMOTE_STORE="dummy://" | ||
|
||
simpleTest () { | ||
local expr=$1; shift | ||
local result=$1; shift | ||
# rest, extra args | ||
|
||
[[ "$(nix eval --impure --raw "$@" --expr "$expr")" == "$result" ]] | ||
} | ||
|
||
# `builtins.storeDir` | ||
|
||
## Store dir follows `store` store setting | ||
simpleTest 'builtins.storeDir' '/foo' --store "$REMOTE_STORE?store=/foo" | ||
simpleTest 'builtins.storeDir' '/bar' --store "$REMOTE_STORE?store=/bar" | ||
|
||
# `builtins.currentSystem` | ||
|
||
## `system` alone affects by default | ||
simpleTest 'builtins.currentSystem' 'foo' --system 'foo' | ||
simpleTest 'builtins.currentSystem' 'bar' --system 'bar' | ||
|
||
## `system` affects if `eval-system` is an empty string | ||
simpleTest 'builtins.currentSystem' 'foo' --system 'foo' --eval-system '' | ||
simpleTest 'builtins.currentSystem' 'bar' --system 'bar' --eval-system '' | ||
|
||
## `eval-system` alone affects | ||
simpleTest 'builtins.currentSystem' 'foo' --eval-system 'foo' | ||
simpleTest 'builtins.currentSystem' 'bar' --eval-system 'bar' | ||
|
||
## `eval-system` overrides `system` | ||
simpleTest 'builtins.currentSystem' 'bar' --system 'foo' --eval-system 'bar' | ||
simpleTest 'builtins.currentSystem' 'baz' --system 'foo' --eval-system 'baz' |
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