aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/common.sh.in6
-rw-r--r--tests/nix-channel.sh13
-rw-r--r--tests/nix-profile.sh8
3 files changed, 25 insertions, 2 deletions
diff --git a/tests/common.sh.in b/tests/common.sh.in
index 74bbbc8ca..bbe97da68 100644
--- a/tests/common.sh.in
+++ b/tests/common.sh.in
@@ -27,6 +27,8 @@ export NIX_REMOTE=$NIX_REMOTE_
unset NIX_PATH
export TEST_HOME=$TEST_ROOT/test-home
export HOME=$TEST_HOME
+unset XDG_STATE_HOME
+unset XDG_DATA_HOME
unset XDG_CONFIG_HOME
unset XDG_CONFIG_DIRS
unset XDG_CACHE_HOME
@@ -62,8 +64,8 @@ readLink() {
}
clearProfiles() {
- profiles="$HOME"/.local/share/nix/profiles
- rm -rf $profiles
+ profiles="$HOME"/.local/state/nix/profiles
+ rm -rf "$profiles"
}
clearStore() {
diff --git a/tests/nix-channel.sh b/tests/nix-channel.sh
index 54b8f5979..b64283f48 100644
--- a/tests/nix-channel.sh
+++ b/tests/nix-channel.sh
@@ -12,6 +12,19 @@ nix-channel --remove xyzzy
[ -e $TEST_HOME/.nix-channels ]
[ "$(cat $TEST_HOME/.nix-channels)" = '' ]
+# Test the XDG Base Directories support
+
+export NIX_CONFIG="use-xdg-base-directories = true"
+
+nix-channel --add http://foo/bar xyzzy
+nix-channel --list | grep -q http://foo/bar
+nix-channel --remove xyzzy
+
+unset NIX_CONFIG
+
+[ -e $TEST_HOME/.local/state/nix/channels ]
+[ "$(cat $TEST_HOME/.local/state/nix/channels)" = '' ]
+
# Create a channel.
rm -rf $TEST_ROOT/foo
mkdir -p $TEST_ROOT/foo
diff --git a/tests/nix-profile.sh b/tests/nix-profile.sh
index 7ba3235fa..266dc9e49 100644
--- a/tests/nix-profile.sh
+++ b/tests/nix-profile.sh
@@ -56,6 +56,14 @@ nix profile history
nix profile history | grep "packages.$system.default: ∅ -> 1.0"
nix profile diff-closures | grep 'env-manifest.nix: ε → ∅'
+# Test XDG Base Directories support
+
+export NIX_CONFIG="use-xdg-base-directories = true"
+nix profile remove 1
+nix profile install $flake1Dir
+[[ $($TEST_HOME/.local/state/nix/profile/bin/hello) = "Hello World" ]]
+unset NIX_CONFIG
+
# Test upgrading a package.
printf NixOS > $flake1Dir/who
printf 2.0 > $flake1Dir/version