| 37 | static bool g_python_mode = false; |
| 38 | |
| 39 | int main(int argc, char *argv[]) { |
| 40 | testing t(std::cout); |
| 41 | t.verbose = true; |
| 42 | |
| 43 | // usage: test-jinja [-py] [filter_regex] |
| 44 | // -py : enable python mode (use python jinja2 for rendering expected output) |
| 45 | // only use this for cross-checking, not for correctness |
| 46 | // note: the implementation of this flag is basic, only intented to be used by maintainers |
| 47 | |
| 48 | for (int i = 1; i < argc; i++) { |
| 49 | std::string arg = argv[i]; |
| 50 | if (arg == "-py") { |
| 51 | g_python_mode = true; |
| 52 | } else { |
| 53 | t.set_filter(arg); |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | t.test("whitespace control", test_whitespace_control); |
| 58 | t.test("conditionals", test_conditionals); |
| 59 | t.test("loops", test_loops); |
| 60 | t.test("expressions", test_expressions); |
| 61 | t.test("set statement", test_set_statement); |
| 62 | t.test("filters", test_filters); |
| 63 | t.test("literals", test_literals); |
| 64 | t.test("comments", test_comments); |
| 65 | t.test("macros", test_macros); |
| 66 | t.test("namespace", test_namespace); |
| 67 | t.test("tests", test_tests); |
| 68 | t.test("string methods", test_string_methods); |
| 69 | t.test("array methods", test_array_methods); |
| 70 | t.test("object methods", test_object_methods); |
| 71 | if (!g_python_mode) { |
| 72 | t.test("hasher", test_hasher); |
| 73 | t.test("fuzzing", test_fuzzing); |
| 74 | } |
| 75 | |
| 76 | return t.summary(); |
| 77 | } |
| 78 | |
| 79 | static void test_whitespace_control(testing & t) { |
| 80 | test_template(t, "trim_blocks removes newline after tag", |
nothing calls this directly
no test coverage detected