diff options
author | piegames <git@piegames.de> | 2024-07-13 05:24:41 +0200 |
---|---|---|
committer | piegames <git@piegames.de> | 2024-08-17 19:47:51 +0200 |
commit | 49d61b2e4bf338042364c85d3c2ead0b33963e65 (patch) | |
tree | 09ffba6841df5a3990aa2d1c6bb9e19e0e355b14 /tests/unit | |
parent | 1c080a8239f1be5a61d9fb2121ca958542ec183f (diff) |
libexpr: Introduce Deprecated features
They are like experimental features, but opt-in instead of opt-out. They
will allow us to gracefully remove language features. See #437
Change-Id: I9ca04cc48e6926750c4d622c2b229b25cc142c42
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/libexpr-support/tests/libexpr.hh | 4 | ||||
-rw-r--r-- | tests/unit/libexpr/trivial.cc | 26 |
2 files changed, 15 insertions, 15 deletions
diff --git a/tests/unit/libexpr-support/tests/libexpr.hh b/tests/unit/libexpr-support/tests/libexpr.hh index 745aa168d..642632baa 100644 --- a/tests/unit/libexpr-support/tests/libexpr.hh +++ b/tests/unit/libexpr-support/tests/libexpr.hh @@ -26,9 +26,9 @@ namespace nix { , state({}, store) { } - Value eval(std::string input, bool forceValue = true, const ExperimentalFeatureSettings & xpSettings = experimentalFeatureSettings) { + Value eval(std::string input, bool forceValue = true, const FeatureSettings & fSettings = featureSettings) { Value v; - Expr & e = state.parseExprFromString(input, state.rootPath(CanonPath::root), xpSettings); + Expr & e = state.parseExprFromString(input, state.rootPath(CanonPath::root), fSettings); state.eval(e, v); if (forceValue) state.forceValue(v, noPos); diff --git a/tests/unit/libexpr/trivial.cc b/tests/unit/libexpr/trivial.cc index c984657fd..46f9b7499 100644 --- a/tests/unit/libexpr/trivial.cc +++ b/tests/unit/libexpr/trivial.cc @@ -214,36 +214,36 @@ namespace nix { // pipes are gated behind an experimental feature flag TEST_F(TrivialExpressionTest, pipeDisabled) { ASSERT_THROW(eval("let add = l: r: l + r; in ''a'' |> add ''b''"), Error); - ASSERT_THROW(eval("let add = l: r: l + r; in ''a'' <| add ''b''"), Error); + ASSERT_THROW(eval("let add = l: r: l + r; in add ''a'' <| ''b''"), Error); } TEST_F(TrivialExpressionTest, pipeRight) { - ExperimentalFeatureSettings mockXpSettings; - mockXpSettings.set("experimental-features", "pipe-operator"); + FeatureSettings mockFeatureSettings; + mockFeatureSettings.set("experimental-features", "pipe-operator"); - auto v = eval("let add = l: r: l + r; in ''a'' |> add ''b''", true, mockXpSettings); + auto v = eval("let add = l: r: l + r; in ''a'' |> add ''b''", true, mockFeatureSettings); ASSERT_THAT(v, IsStringEq("ba")); - v = eval("let add = l: r: l + r; in ''a'' |> add ''b'' |> add ''c''", true, mockXpSettings); + v = eval("let add = l: r: l + r; in ''a'' |> add ''b'' |> add ''c''", true, mockFeatureSettings); ASSERT_THAT(v, IsStringEq("cba")); } TEST_F(TrivialExpressionTest, pipeLeft) { - ExperimentalFeatureSettings mockXpSettings; - mockXpSettings.set("experimental-features", "pipe-operator"); + FeatureSettings mockFeatureSettings; + mockFeatureSettings.set("experimental-features", "pipe-operator"); - auto v = eval("let add = l: r: l + r; in add ''a'' <| ''b''", true, mockXpSettings); + auto v = eval("let add = l: r: l + r; in add ''a'' <| ''b''", true, mockFeatureSettings); ASSERT_THAT(v, IsStringEq("ab")); - v = eval("let add = l: r: l + r; in add ''a'' <| add ''b'' <| ''c''", true, mockXpSettings); + v = eval("let add = l: r: l + r; in add ''a'' <| add ''b'' <| ''c''", true, mockFeatureSettings); ASSERT_THAT(v, IsStringEq("abc")); } TEST_F(TrivialExpressionTest, pipeMixed) { - ExperimentalFeatureSettings mockXpSettings; - mockXpSettings.set("experimental-features", "pipe-operator"); + FeatureSettings mockFeatureSettings; + mockFeatureSettings.set("experimental-features", "pipe-operator"); - auto v = eval("let add = l: r: l + r; in add ''a'' <| ''b'' |> add ''c''", true, mockXpSettings); + auto v = eval("let add = l: r: l + r; in add ''a'' <| ''b'' |> add ''c''", true, mockFeatureSettings); ASSERT_THAT(v, IsStringEq("acb")); - v = eval("let add = l: r: l + r; in ''a'' |> add <| ''c''", true, mockXpSettings); + v = eval("let add = l: r: l + r; in ''a'' |> add <| ''c''", true, mockFeatureSettings); ASSERT_THAT(v, IsStringEq("ac")); } } /* namespace nix */ |