From bcb774688feea4e1fc7919d4890361f4f8ea1f60 Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Sun, 16 Jun 2024 23:10:09 +0200 Subject: libexpr: add expr memory management with the prepatory work done this mostly means turning plain pointers into unique_ptrs, with all the associated churn that necessitates. we might want to change some of these to box_ptrs at some point as well, but that would be a semantic change that isn't fully appropriate yet. Change-Id: I0c238c118617420650432f4ed45569baa3e3f413 --- tests/unit/libexpr/value/print.cc | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'tests/unit/libexpr') diff --git a/tests/unit/libexpr/value/print.cc b/tests/unit/libexpr/value/print.cc index feabc07c1..cdbc8f8f9 100644 --- a/tests/unit/libexpr/value/print.cc +++ b/tests/unit/libexpr/value/print.cc @@ -113,10 +113,8 @@ TEST_F(ValuePrintingTests, vLambda) }; PosTable::Origin origin = state.positions.addOrigin(std::monostate(), 1); auto posIdx = state.positions.add(origin, 0); - auto body = ExprInt(0); - auto formals = Formals {}; - ExprLambda eLambda(posIdx, createSymbol("a"), &formals, &body); + ExprLambda eLambda(posIdx, createSymbol("a"), std::make_unique(), std::make_unique(0)); Value vLambda; vLambda.mkLambda(&env, &eLambda); @@ -515,11 +513,10 @@ TEST_F(ValuePrintingTests, ansiColorsDerivationError) TEST_F(ValuePrintingTests, ansiColorsAssert) { - ExprVar eFalse(state.symbols.create("false")); - eFalse.bindVars(state, state.staticBaseEnv); - ExprInt eInt(1); - - ExprAssert expr(noPos, &eFalse, &eInt); + ExprAssert expr(noPos, + std::make_unique(state.symbols.create("false")), + std::make_unique(1)); + expr.bindVars(state, state.staticBaseEnv); Value v; state.mkThunk_(v, expr); @@ -561,10 +558,8 @@ TEST_F(ValuePrintingTests, ansiColorsLambda) }; PosTable::Origin origin = state.positions.addOrigin(std::monostate(), 1); auto posIdx = state.positions.add(origin, 0); - auto body = ExprInt(0); - auto formals = Formals {}; - ExprLambda eLambda(posIdx, createSymbol("a"), &formals, &body); + ExprLambda eLambda(posIdx, createSymbol("a"), std::make_unique(), std::make_unique(0)); Value vLambda; vLambda.mkLambda(&env, &eLambda); -- cgit v1.2.3