From b4c354b0137dd5c528393436754897ef811e4227 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 14 Jul 2022 16:15:35 +0200 Subject: [PATCH] Fix unsafeGetAttrPos test --- src/libexpr/tests/primops.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libexpr/tests/primops.cc b/src/libexpr/tests/primops.cc index 16cf66d2c..d6f88bba6 100644 --- a/src/libexpr/tests/primops.cc +++ b/src/libexpr/tests/primops.cc @@ -148,15 +148,15 @@ namespace nix { } TEST_F(PrimOpTest, unsafeGetAttrPos) { - // The `y` attribute is at position - const char* expr = "builtins.unsafeGetAttrPos \"y\" { y = \"x\"; }"; + state.corepkgsFS->addFile(CanonPath("foo.nix"), "{ y = \"x\"; }"); + + auto expr = "builtins.unsafeGetAttrPos \"y\" (import )"; auto v = eval(expr); ASSERT_THAT(v, IsAttrsOfSize(3)); auto file = v.attrs->find(createSymbol("file")); ASSERT_NE(file, nullptr); - // FIXME: The file when running these tests is the input string?!? - ASSERT_THAT(*file->value, IsStringEq(expr)); + ASSERT_THAT(*file->value, IsStringEq("/foo.nix")); auto line = v.attrs->find(createSymbol("line")); ASSERT_NE(line, nullptr); @@ -164,7 +164,7 @@ namespace nix { auto column = v.attrs->find(createSymbol("column")); ASSERT_NE(column, nullptr); - ASSERT_THAT(*column->value, IsIntEq(33)); + ASSERT_THAT(*column->value, IsIntEq(3)); } TEST_F(PrimOpTest, hasAttr) {