Closed dvirtz closed 1 year ago
Thank you for reporting. This is because the standard library regexes only supports those. I'll see what I can do. I believe it can be done without too much trouble.
Can you try branch string_view_re
and report back how it works?
Looks good. This is the test I did:
#include <trompeloeil.hpp>
#include <string_view>
#include <iostream>
struct S
{
MAKE_MOCK1(func, void(std::string_view));
};
int main() {
S s;
ALLOW_CALL(s, func(trompeloeil::re("3")));
s.func("3");
try {
s.func("4");
} catch (const std::exception& ex) {
std::cerr << "error: " << ex.what() << '\n';
}
}
output is:
error:
No match for call of func with signature void(std::string_view) with.
param _1 == 4
Tried s.func(trompeloeil::re("3")) at C:\Users\dyitzchaki\github\conan-center-index\recipes\trompeloeil\all\test_package\test_package.cpp:12
Expected _1 matching regular expression /3/
I'm traveling right now, but I'll try to find the time to squeeze in a release tag soon.
Tagged v45 which includes this fix, so closing now.
Currently
trompeloeil::re
only supportsstd::string
or C-style strings. Trying to use it with astd::string_view
parameter results in the error