Separate spec helpers files for compiler and runtime specs
This commit is contained in:
parent
b167ee84fa
commit
142671c177
24 changed files with 99 additions and 71 deletions
|
|
@ -1,13 +1,19 @@
|
|||
#include "spec_helper.h"
|
||||
#include "compiler_spec_helper.h"
|
||||
#include "../../examples/grammars/json.hpp"
|
||||
#include "../../examples/grammars/arithmetic.hpp"
|
||||
#include <fstream>
|
||||
|
||||
static string src_dir() {
|
||||
const char * dir = getenv("TREESITTER_DIR");
|
||||
if (!dir) dir = getenv("PWD");
|
||||
return dir;
|
||||
}
|
||||
|
||||
START_TEST
|
||||
|
||||
describe("compiling the example grammars", []() {
|
||||
string example_parser_dir = src_dir() + "/examples/parsers/";
|
||||
|
||||
|
||||
it("compiles the arithmetic grammar", [&]() {
|
||||
Grammar grammar = test_grammars::arithmetic();
|
||||
ofstream(example_parser_dir + "arithmetic.c") << compile(grammar, "arithmetic");
|
||||
|
|
@ -19,4 +25,4 @@ describe("compiling the example grammars", []() {
|
|||
});
|
||||
});
|
||||
|
||||
END_TEST
|
||||
END_TEST
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue