Fix indentation in specs
This commit is contained in:
parent
01571da30d
commit
b155994491
34 changed files with 1877 additions and 1878 deletions
|
|
@ -2,44 +2,45 @@
|
|||
#include <fstream>
|
||||
|
||||
static string src_dir() {
|
||||
const char * dir = getenv("TREESITTER_DIR");
|
||||
if (!dir) dir = getenv("PWD");
|
||||
return dir;
|
||||
const char * dir = getenv("TREESITTER_DIR");
|
||||
if (!dir) dir = getenv("PWD");
|
||||
return dir;
|
||||
}
|
||||
|
||||
namespace tree_sitter_examples {
|
||||
extern const Grammar arithmetic;
|
||||
extern const Grammar javascript;
|
||||
extern const Grammar json;
|
||||
extern const Grammar golang;
|
||||
}
|
||||
|
||||
extern const Grammar arithmetic;
|
||||
extern const Grammar javascript;
|
||||
extern const Grammar json;
|
||||
extern const Grammar golang;
|
||||
|
||||
} // namespace tree_sitter_examples
|
||||
|
||||
START_TEST
|
||||
|
||||
describe("compiling the example grammars", []() {
|
||||
string example_parser_dir = src_dir() + "/examples/parsers/";
|
||||
string example_parser_dir = src_dir() + "/examples/parsers/";
|
||||
|
||||
auto compile_grammar = [&](const Grammar &grammar, string language) {
|
||||
it(("compiles the " + language + " grammar").c_str(), [&]() {
|
||||
ofstream file(example_parser_dir + language + ".c");
|
||||
auto compile_grammar = [&](const Grammar &grammar, string language) {
|
||||
it(("compiles the " + language + " grammar").c_str(), [&]() {
|
||||
ofstream file(example_parser_dir + language + ".c");
|
||||
|
||||
auto result = compile(grammar, language);
|
||||
string code = get<0>(result);
|
||||
vector<Conflict> conflicts = get<1>(result);
|
||||
const GrammarError *error = get<2>(result);
|
||||
auto result = compile(grammar, language);
|
||||
string code = get<0>(result);
|
||||
vector<Conflict> conflicts = get<1>(result);
|
||||
const GrammarError *error = get<2>(result);
|
||||
|
||||
AssertThat(error, Equals((GrammarError *)nullptr));
|
||||
// cout << "\n\nconflicts for " << language << ":\n" << get<1>(result);
|
||||
AssertThat(error, Equals((GrammarError *)nullptr));
|
||||
|
||||
file << get<0>(result);
|
||||
file.close();
|
||||
});
|
||||
};
|
||||
file << get<0>(result);
|
||||
file.close();
|
||||
});
|
||||
};
|
||||
|
||||
compile_grammar(tree_sitter_examples::arithmetic, "arithmetic");
|
||||
compile_grammar(tree_sitter_examples::json, "json");
|
||||
compile_grammar(tree_sitter_examples::javascript, "javascript");
|
||||
compile_grammar(tree_sitter_examples::golang, "golang");
|
||||
compile_grammar(tree_sitter_examples::arithmetic, "arithmetic");
|
||||
compile_grammar(tree_sitter_examples::json, "json");
|
||||
compile_grammar(tree_sitter_examples::javascript, "javascript");
|
||||
compile_grammar(tree_sitter_examples::golang, "golang");
|
||||
});
|
||||
|
||||
END_TEST
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue