approvals / ApprovalTests.cpp

Native ApprovalTests for C++ on Linux, Mac and Windows
https://approvaltestscpp.readthedocs.io/en/latest/
Apache License 2.0
312 stars 51 forks source link

[boost/ut.hpp] Unknown source error when the topmost lambda captures #177

Closed sam20908 closed 3 years ago

sam20908 commented 3 years ago

It works fine if the lambda wasn't captured.

Reduced repro:

#define APPROVALS_UT
#include <ApprovalTests.hpp>

int main()
{
    boost::ut::test("test") = [&]() {
        ApprovalTests::Approvals::verify(42);
    };
}
claremacrae commented 3 years ago

Thanks for reporting this.

It's good to know that the Boost.ut integration is being used.

As far as I can tell, this looks to be the same as #157 - although the observation that it's the top-most lambda that matters is interesting.

We suspect it's an issue in the Boost.ut framework, and have added a test to detect if the behaviour ever improves:

https://github.com/approvals/ApprovalTests.cpp/commit/eb963098d563df2b75889f2b2102d7d8021e915e

claremacrae commented 3 years ago

I have logged this issue in the boost.ut project: https://github.com/boost-ext/ut/issues/434