nix-super/tests/experimental-features.sh
John Ericson 4a0b893d5e Stuctured command stability
Prior to this, there was an ad-hoc whitelist in `main.cc`. Now, every
command states its stability.

In a future PR, we will adjust the manual to take advantage of this new
information in the JSON.
(It will be easier to do that once we have some experimental feature
docs to link too; see #5930 and #7798.)
2023-04-03 11:48:21 -04:00

40 lines
1.6 KiB
Bash

source common.sh
# Without flakes, flake options should not show up
# With flakes, flake options should show up
function both_ways {
nix --experimental-features 'nix-command' "$@" | grepQuietInverse flake
nix --experimental-features 'nix-command flakes' "$@" | grepQuiet flake
# Also, the order should not matter
nix "$@" --experimental-features 'nix-command' | grepQuietInverse flake
nix "$@" --experimental-features 'nix-command flakes' | grepQuiet flake
}
# Simple case, the configuration effects the running command
both_ways show-config
# Skipping for now, because we actually *do* want these to show up in
# the manual, just be marked experimental. Will reenable once the manual
# generation takes advantage of the JSON metadata on this.
# both_ways store gc --help
expect 1 nix --experimental-features 'nix-command' show-config --flake-registry 'https://no'
nix --experimental-features 'nix-command flakes' show-config --flake-registry 'https://no'
# Double check these are stable
nix --experimental-features '' --help
nix --experimental-features '' doctor --help
nix --experimental-features '' repl --help
nix --experimental-features '' upgrade-nix --help
# These 3 arguments are currently given to all commands, which is wrong (as not
# all care). To deal with fixing later, we simply make them require the
# nix-command experimental features --- it so happens that the commands we wish
# stabilizing to do not need them anyways.
for arg in '--print-build-logs' '--offline' '--refresh'; do
nix --experimental-features 'nix-command' "$arg" --help
! nix --experimental-features '' "$arg" --help
done