Regex: Disable dumping regex instructions by default in unit tests

This commit is contained in:
Maxime Coste 2017-09-26 23:31:18 +09:00
parent d5048281a6
commit e41d228af8

View File

@ -583,7 +583,7 @@ private:
const ParsedRegex& m_parsed_regex; const ParsedRegex& m_parsed_regex;
}; };
void dump(const CompiledRegex& program) void dump_regex(const CompiledRegex& program)
{ {
for (auto pos = program.bytecode.data(), end = program.bytecode.data() + program.bytecode.size(); for (auto pos = program.bytecode.data(), end = program.bytecode.data() + program.bytecode.size();
pos < end; ) pos < end; )
@ -840,10 +840,10 @@ void validate_regex(StringView re)
auto test_regex = UnitTest{[]{ auto test_regex = UnitTest{[]{
struct TestVM : ThreadedRegexVM<const char*> struct TestVM : ThreadedRegexVM<const char*>
{ {
TestVM(StringView re) TestVM(StringView re, bool dump = false)
: ThreadedRegexVM{m_program}, : ThreadedRegexVM{m_program},
m_program{RegexCompiler::compile(re)} m_program{RegexCompiler::compile(re)}
{ dump(m_program); } { if (dump) dump_regex(m_program); }
CompiledRegex m_program; CompiledRegex m_program;
}; };