diff options
author | piegames <git@piegames.de> | 2024-07-13 07:55:17 +0200 |
---|---|---|
committer | piegames <git@piegames.de> | 2024-08-17 20:31:57 +0200 |
commit | 278fddc317cf0cf4d3602d0ec0f24d1dd281fadb (patch) | |
tree | 002c63288018f70755e2a60f9af554fe5cbca85b /tests | |
parent | 49d61b2e4bf338042364c85d3c2ead0b33963e65 (diff) |
libexpr: Deprecate URL literals
Closes #437.
Change-Id: I9f67fc965bb4a7e7fd849e5067ac1cb3bab064cd
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/functional/lang.sh | 7 | ||||
-rw-r--r-- | tests/functional/lang/parse-okay-regression-20041027.nix | 1 | ||||
-rw-r--r-- | tests/functional/lang/parse-okay-url.nix | 1 | ||||
-rw-r--r-- | tests/unit/libexpr/trivial.cc | 10 |
4 files changed, 13 insertions, 6 deletions
diff --git a/tests/functional/lang.sh b/tests/functional/lang.sh index 94c00bad0..aa41b41d8 100755 --- a/tests/functional/lang.sh +++ b/tests/functional/lang.sh @@ -53,8 +53,13 @@ done for i in lang/parse-okay-*.nix; do echo "parsing $i (should succeed)"; i=$(basename "$i" .nix) + # Hard-code that these two files are allowed to use url literals (because they test them) + if [[ "$i" == "parse-okay-url" || "$i" == "parse-okay-regression-20041027" ]] + then + extraArgs="--extra-deprecated-features url-literals" + fi if - expect 0 nix-instantiate --parse - < "lang/$i.nix" \ + expect 0 nix-instantiate --parse ${extraArgs-} - < "lang/$i.nix" \ 1> "lang/$i.out" \ 2> "lang/$i.err" then diff --git a/tests/functional/lang/parse-okay-regression-20041027.nix b/tests/functional/lang/parse-okay-regression-20041027.nix index ae2e256ee..541264b16 100644 --- a/tests/functional/lang/parse-okay-regression-20041027.nix +++ b/tests/functional/lang/parse-okay-regression-20041027.nix @@ -1,3 +1,4 @@ +# This test needs to be run with --extra-deprecated-features url-literals {stdenv, fetchurl /* pkgconfig, libX11 */ }: stdenv.mkDerivation { diff --git a/tests/functional/lang/parse-okay-url.nix b/tests/functional/lang/parse-okay-url.nix index 08de27d0a..f74a72bb1 100644 --- a/tests/functional/lang/parse-okay-url.nix +++ b/tests/functional/lang/parse-okay-url.nix @@ -1,3 +1,4 @@ +# This test needs to be run with --extra-deprecated-features url-literals [ x:x https://svn.cs.uu.nl:12443/repos/trace/trunk http://www2.mplayerhq.hu/MPlayer/releases/fonts/font-arial-iso-8859-1.tar.bz2 diff --git a/tests/unit/libexpr/trivial.cc b/tests/unit/libexpr/trivial.cc index 46f9b7499..905e258bc 100644 --- a/tests/unit/libexpr/trivial.cc +++ b/tests/unit/libexpr/trivial.cc @@ -87,15 +87,15 @@ namespace nix { } TEST_F(TrivialExpressionTest, urlLiteral) { - auto v = eval("https://nixos.org"); + FeatureSettings mockFeatureSettings; + mockFeatureSettings.set("deprecated-features", "url-literals"); + + auto v = eval("https://nixos.org", true, mockFeatureSettings); ASSERT_THAT(v, IsStringEq("https://nixos.org")); } TEST_F(TrivialExpressionTest, noUrlLiteral) { - ExperimentalFeatureSettings mockXpSettings; - mockXpSettings.set("experimental-features", "no-url-literals"); - - ASSERT_THROW(eval("https://nixos.org", true, mockXpSettings), Error); + ASSERT_THROW(eval("https://nixos.org"), Error); } TEST_F(TrivialExpressionTest, withFound) { |