From a29bb5840ce482528eea83855f8afc38fbe5aea5 Mon Sep 17 00:00:00 2001 From: zapashcanon Date: Thu, 17 Feb 2022 23:17:22 +0100 Subject: [PATCH] clean code --- .ocamlformat | 42 ++++++++++++++++++++++++++++++++++++++++++ examples/print_code.ml | 13 +++++++------ src/dune | 2 -- test/dune | 4 ++-- test/test.ml | 12 ++++++------ 5 files changed, 57 insertions(+), 16 deletions(-) create mode 100644 .ocamlformat diff --git a/.ocamlformat b/.ocamlformat new file mode 100644 index 0000000..cc34f68 --- /dev/null +++ b/.ocamlformat @@ -0,0 +1,42 @@ +version=0.20.1 +assignment-operator=end-line +break-cases=fit +break-fun-decl=wrap +break-fun-sig=wrap +break-infix=wrap +break-infix-before-func=false +break-separators=before +break-sequences=true +cases-exp-indent=2 +cases-matching-exp-indent=normal +doc-comments=before +doc-comments-padding=2 +doc-comments-tag-only=default +dock-collection-brackets=false +exp-grouping=preserve +field-space=loose +if-then-else=compact +indicate-multiline-delimiters=space +indicate-nested-or-patterns=unsafe-no +infix-precedence=indent +leading-nested-match-parens=false +let-and=sparse +let-binding-spacing=compact +let-module=compact +margin=80 +max-indent=68 +module-item-spacing=sparse +ocp-indent-compat=false +parens-ite=false +parens-tuple=always +parse-docstrings=true +sequence-blank-line=preserve-one +sequence-style=terminator +single-case=compact +space-around-arrays=true +space-around-lists=true +space-around-records=true +space-around-variants=true +type-decl=sparse +wrap-comments=false +wrap-fun-args=true diff --git a/examples/print_code.ml b/examples/print_code.ml index ae023f0..17cc1c2 100644 --- a/examples/print_code.ml +++ b/examples/print_code.ml @@ -1,7 +1,8 @@ let () = - Format.printf "succes code is %d@." Exit.success_code ; - Format.printf "failure code is %d@." Exit.failure_code ; - if Exit.success_code <> 0 || Exit.failure_code <> 1 then ( - Format.printf "not POSIX !@." ; - Exit.failure () ) ; - Exit.success () + Format.printf "succes code is %d@\n" Exit.success_code; + Format.printf "failure code is %d@\n" Exit.failure_code; + if Exit.success_code = 0 && Exit.failure_code = 1 then Exit.success () + else begin + Format.printf "not POSIX !@\n"; + Exit.failure () + end diff --git a/src/dune b/src/dune index bb471e8..76404fd 100644 --- a/src/dune +++ b/src/dune @@ -3,8 +3,6 @@ (modules exit external) (private_modules external) (wrapped false) - (preprocess - (pps bisect_ppx -- --conditional)) (foreign_stubs (language c) (names external_stubs))) diff --git a/test/dune b/test/dune index 5046d24..f2f5713 100644 --- a/test/dune +++ b/test/dune @@ -1,3 +1,3 @@ (test - (name test) - (libraries exit)) + (name test) + (libraries exit)) diff --git a/test/test.ml b/test/test.ml index e30f66d..faf9d43 100644 --- a/test/test.ml +++ b/test/test.ml @@ -1,6 +1,6 @@ -;; -assert (Exit.success_code >= 0) ; -assert (Exit.failure_code >= 0) ; -assert (Exit.success_code <= 255) ; -assert (Exit.failure_code <= 255) ; -assert (Exit.success_code <> Exit.failure_code) +let () = + assert (Exit.success_code >= 0); + assert (Exit.failure_code >= 0); + assert (Exit.success_code <= 255); + assert (Exit.failure_code <= 255); + assert (Exit.success_code <> Exit.failure_code)