Add logging debugger for debugging failing tests
This commit is contained in:
parent
41a067fef9
commit
ae0a7fc97d
2 changed files with 29 additions and 0 deletions
21
spec/runtime/helpers/log_debugger.cc
Normal file
21
spec/runtime/helpers/log_debugger.cc
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#include "tree_sitter/runtime.h"
|
||||
#include <stdio.h>
|
||||
|
||||
static void log_debug(void *data, TSDebugType type, const char *msg) {
|
||||
switch (type) {
|
||||
case TSDebugTypeParse:
|
||||
fprintf(stderr, "* %s\n", msg);
|
||||
break;
|
||||
case TSDebugTypeLex:
|
||||
fprintf(stderr, " %s\n", msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
TSDebugger log_debugger_make() {
|
||||
TSDebugger result;
|
||||
result.data = NULL;
|
||||
result.debug_fn = log_debug;
|
||||
result.release_fn = NULL;
|
||||
return result;
|
||||
}
|
||||
8
spec/runtime/helpers/log_debugger.h
Normal file
8
spec/runtime/helpers/log_debugger.h
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef HELPERS_LOG_DEBUGGER_H_
|
||||
#define HELPERS_LOG_DEBUGGER_H_
|
||||
|
||||
#include "tree_sitter/runtime.h"
|
||||
|
||||
TSDebugger log_debugger_make();
|
||||
|
||||
#endif // HELPERS_LOG_DEBUGGER_H_
|
||||
Loading…
Add table
Add a link
Reference in a new issue