tree-sitter/spec/compiler/compile_examples.cpp
2014-02-17 13:18:09 -08:00

22 lines
No EOL
666 B
C++

#include "spec_helper.h"
#include "../../examples/grammars/json.hpp"
#include "../../examples/grammars/arithmetic.hpp"
#include <fstream>
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");
});
it("compiles the json grammar", [&]() {
Grammar grammar = test_grammars::json();
ofstream(example_parser_dir + "json.c") << compile(grammar, "json");
});
});
END_TEST