From 917b5d22605b043aac95fdeb4602b653fc5204e3 Mon Sep 17 00:00:00 2001 From: ochafik Date: Tue, 12 Mar 2024 03:51:32 +0000 Subject: [PATCH] json: nits + regen deps --- examples/server/json-schema-to-grammar.hpp | 0 tests/test-json-schema-to-grammar.cpp | 4 +++- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 examples/server/json-schema-to-grammar.hpp diff --git a/examples/server/json-schema-to-grammar.hpp b/examples/server/json-schema-to-grammar.hpp new file mode 100644 index 000000000..e69de29bb diff --git a/tests/test-json-schema-to-grammar.cpp b/tests/test-json-schema-to-grammar.cpp index c07a105ef..07b284f1b 100755 --- a/tests/test-json-schema-to-grammar.cpp +++ b/tests/test-json-schema-to-grammar.cpp @@ -50,7 +50,7 @@ struct TestCase { void verify(const string& series, const string& actual) const { if (trim(actual) != trim(expected)) { cerr << "#" << endl; - cerr << "# Test " << series.c_str() << " / " << name.c_str() << " failed." << endl; + cerr << "# Test " << name.c_str() << " (" << series.c_str() << ") failed." << endl; cerr << "#" << endl; cerr << schema.c_str() << endl; cerr << "# EXPECTED:\n" << expected.c_str() << endl; @@ -68,12 +68,14 @@ static void run_py(const TestCase& tc) { std::system(("python ./examples/json-schema-to-grammar.py " + INPUT_NAME + " > " + OUT_NAME).c_str()); tc.read_and_verify("Python"); } + static void run_mjs(const TestCase& tc) { cerr << "# Running MJS " << tc.name.c_str() << endl; tc.prepare(); std::system(("node ./tests/run-json-schema-to-grammar.mjs " + INPUT_NAME + " > " + OUT_NAME).c_str()); tc.read_and_verify("JavaScript"); } + static void run_cpp(const TestCase& tc) { cerr << "# Running C++ " << tc.name.c_str() << endl; auto actual = json_schema_to_grammar(nlohmann::json::parse(tc.schema));