@@ -803,18 +803,28 @@ int main() {
803
803
tc.verify_status (FAILURE);
804
804
}
805
805
});
806
- // test_all("Python", [](const TestCase & tc) {
807
- // write("test-json-schema-input.tmp", tc.schema);
808
- // tc.verify_status(std::system(
809
- // "python ./examples/json-schema-to-grammar.py test-json-schema-input.tmp > test-grammar-output.tmp") == 0 ? SUCCESS : FAILURE);
810
- // tc.verify(read("test-grammar-output.tmp"));
811
- // });
812
- // test_all("JavaScript", [](const TestCase & tc) {
813
- // write("test-json-schema-input.tmp", tc.schema);
814
- // tc.verify_status(std::system(
815
- // "node ./tests/run-json-schema-to-grammar.mjs test-json-schema-input.tmp > test-grammar-output.tmp") == 0 ? SUCCESS : FAILURE);
816
- // tc.verify(read("test-grammar-output.tmp"));
817
- // });
806
+
807
+ if (std::system (" python --version" ) == 0 ) {
808
+ test_all (" Python" , [](const TestCase & tc) {
809
+ write (" test-json-schema-input.tmp" , tc.schema );
810
+ tc.verify_status (std::system (
811
+ " python ./examples/json-schema-to-grammar.py test-json-schema-input.tmp > test-grammar-output.tmp" ) == 0 ? SUCCESS : FAILURE);
812
+ tc.verify (read (" test-grammar-output.tmp" ));
813
+ });
814
+ } else {
815
+ fprintf (stderr, " #\n # WARNING: Python not found, skipping Python JSON schema -> grammar tests!\n #\n " );
816
+ }
817
+
818
+ if (std::system (" node --version" ) == 0 ) {
819
+ test_all (" JavaScript" , [](const TestCase & tc) {
820
+ write (" test-json-schema-input.tmp" , tc.schema );
821
+ tc.verify_status (std::system (
822
+ " node ./tests/run-json-schema-to-grammar.mjs test-json-schema-input.tmp > test-grammar-output.tmp" ) == 0 ? SUCCESS : FAILURE);
823
+ tc.verify (read (" test-grammar-output.tmp" ));
824
+ });
825
+ } else {
826
+ fprintf (stderr, " #\n # WARNING: Node not found, skipping JavaScript JSON schema -> grammar tests!\n #\n " );
827
+ }
818
828
819
829
test_all (" Check Expectations Validity" , [](const TestCase & tc) {
820
830
if (tc.expected_status == SUCCESS) {
0 commit comments