From 0f9f5d50bd04e23956e3c84359042659ed25149f Mon Sep 17 00:00:00 2001 From: Chimrod <> Date: Thu, 4 Jan 2024 08:18:39 +0100 Subject: Added return code to tell if everything is ok --- bin/qsp_parser.ml | 16 ++++++++-------- readme.md | 4 ++++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/bin/qsp_parser.ml b/bin/qsp_parser.ml index 70f474e..1e897a0 100644 --- a/bin/qsp_parser.ml +++ b/bin/qsp_parser.ml @@ -149,11 +149,11 @@ let () = with Qparser.Lexer.EOF -> () in - let () = - match (!ctx.error_nb, !ctx.warn_nb) with - | 0, 0 -> print_endline "No errors found" - | _ -> - Printf.printf "Found %d error(s), %d warning(s)\n" !ctx.error_nb - !ctx.warn_nb - in - () + match (!ctx.error_nb, !ctx.warn_nb) with + | 0, 0 -> + print_endline "No errors found"; + exit 0 + | _ -> + Printf.printf "Found %d error(s), %d warning(s)\n" !ctx.error_nb + !ctx.warn_nb; + exit 1 diff --git a/readme.md b/readme.md index e6efa88..ce0f022 100644 --- a/readme.md +++ b/readme.md @@ -36,6 +36,10 @@ results will be printed in the standard output: ] Found 0 error(s), 2 warning(s) +### Return code + +The application will return the code `0` when all the tests are passed without +errors or warnings and `1` otherwise. ## Checks provided -- cgit v1.2.3