From 97e649922542ef66c9d80cb1b41817ed07c2c5a6 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 19 Jul 2020 14:37:01 +0100 Subject: test(3p/nix): Partially enable evaluator success tests Enables the `eval-okay-` test suite, with some caveats: * The output is not yet checked against the expected value, so the tests only check that pure evaluation succeeds * A handful of tests have been disabled as they are causing failures that may be related to the DummyStore implementation. Both of these will be addressed in followup commits, but there is already some value in having the pure evaluation tests pass. Change-Id: I62236c95ebffb06dc64a45455a8ee04344c400b7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1284 Tested-by: BuildkiteCI Reviewed-by: isomer Reviewed-by: glittershark --- third_party/nix/src/tests/language-tests.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'third_party/nix/src/tests/language-tests.cc') diff --git a/third_party/nix/src/tests/language-tests.cc b/third_party/nix/src/tests/language-tests.cc index 7e53cd8f5e..daa2fa233e 100644 --- a/third_party/nix/src/tests/language-tests.cc +++ b/third_party/nix/src/tests/language-tests.cc @@ -187,4 +187,25 @@ INSTANTIATE_TEST_SUITE_P(Eval, EvalFailureTest, testing::ValuesIn(TestFilesFor("eval-fail-")), TestNameFor); +class EvalSuccessTest : public testing::TestWithParam {}; + +// Test pattern for files that should fail to evaluate. +TEST_P(EvalSuccessTest, Fails) { + std::shared_ptr store = std::make_shared(); + EvalState state({}, ref(store)); + auto path = GetParam(); + + Expr* expr; + EXPECT_NO_THROW(expr = state.parseExprFromFile(GetParam().string())) + << path.stem().string() << ": should parse successfully"; + + Value result; + state.eval(expr, result); + state.forceValue(result); +} + +INSTANTIATE_TEST_SUITE_P(Eval, EvalSuccessTest, + testing::ValuesIn(TestFilesFor("eval-okay-")), + TestNameFor); + } // namespace nix::tests -- cgit 1.4.1