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