aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/libexpr/trivial.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/libexpr/trivial.cc')
-rw-r--r--tests/unit/libexpr/trivial.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/unit/libexpr/trivial.cc b/tests/unit/libexpr/trivial.cc
index 171727ac7..19b62aff8 100644
--- a/tests/unit/libexpr/trivial.cc
+++ b/tests/unit/libexpr/trivial.cc
@@ -59,6 +59,11 @@ namespace nix {
ASSERT_THAT(v, IsFloatEq(1.234));
}
+ TEST_F(TrivialExpressionTest, pointfloat) {
+ auto v = eval(".234");
+ ASSERT_THAT(v, IsFloatEq(0.234));
+ }
+
TEST_F(TrivialExpressionTest, updateAttrs) {
auto v = eval("{ a = 1; } // { b = 2; a = 3; }");
ASSERT_THAT(v, IsAttrsOfSize(2));
@@ -81,6 +86,18 @@ namespace nix {
ASSERT_THAT(v, IsTrue());
}
+ TEST_F(TrivialExpressionTest, urlLiteral) {
+ auto v = eval("https://nixos.org");
+ 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);
+ }
+
TEST_F(TrivialExpressionTest, withFound) {
auto v = eval("with { a = 23; }; a");
ASSERT_THAT(v, IsIntEq(23));