tree-sitter/spec/compiler/compile_fixtures.cpp

22 lines
626 B
C++
Raw Normal View History

2014-01-11 15:14:17 -08:00
#include "spec_helper.h"
#include "compile.h"
#include "../fixtures/grammars/test_grammars.h"
2014-01-11 15:14:17 -08:00
#include <fstream>
START_TEST
describe("compiling grammars", []() {
2014-01-11 15:14:17 -08:00
string test_parser_dir = src_dir() + "/spec/fixtures/parsers";
it("compiles the arithmetic grammar", [&]() {
2014-01-11 15:14:17 -08:00
Grammar grammar = test_grammars::arithmetic();
ofstream(test_parser_dir + "/arithmetic.c") << compile(grammar, "arithmetic");
});
it("compiles the json grammar", [&]() {
Grammar grammar = test_grammars::json();
ofstream(test_parser_dir + "/json.c") << compile(grammar, "json");
2014-01-11 15:14:17 -08:00
});
});
END_TEST