tree-sitter/test/helpers/spy_logger.cc
Max Brunsfeld 6dc0ff359d Rename spec -> test
'Test' is a lot more straightforward of a name.
2017-03-09 20:40:01 -08:00

22 lines
442 B
C++

#include "helpers/spy_logger.h"
#include <string>
#include <vector>
using std::string;
using std::vector;
static void spy_log(void *data, TSLogType type, const char *msg) {
SpyLogger *logger = static_cast<SpyLogger *>(data);
logger->messages.push_back(msg);
}
TSLogger SpyLogger::logger() {
TSLogger result;
result.payload = (void *)this;
result.log = spy_log;
return result;
}
void SpyLogger::clear() {
messages.clear();
}