Skip to content

Commit

Permalink
Merge pull request #1 from shonfeder/inline-tests-compile-flags
Browse files Browse the repository at this point in the history
Use shared backend for compiler flags tests
  • Loading branch information
lubegasimon authored Sep 1, 2020
2 parents 0d00697 + b73b3fa commit 8ad4df2
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 15 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ to compile_flags field.
First, we pass a valid flag to compile_flags field expecting compilation
to be successful.

$ dune runtest dune-file-with-valid-flag
inline_test_runner_compile_flags_test alias dune-file-with-valid-flag/runtest
$ dune runtest valid_flags --root ./test-project
Entering directory 'test-project'
inline_test_runner_valid_compile_flags_test alias valid_flags/runtest
backend_foo

Lastly, we pass an invalid flag to compile_flags field expecting compilation
to fail.

$ output=$(dune runtest dune-file-with-invalid-flag 2>&1); result=$?; (echo $output | grep -o "unknown option '-flag-that-is-not-accepted-by-ocaml'."); (exit $result)
$ output=$(dune runtest invalid_flags --root ./test-project 2>&1); result=$?; (echo $output | grep -o "unknown option '-flag-that-is-not-accepted-by-ocaml'."); (exit $result)
unknown option '-flag-that-is-not-accepted-by-ocaml'.
[1]
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(library
(name backend_foo)
(modules ())
(inline_tests.backend
(generate_runner
(echo "let () = print_endline \"backend_foo\""))))
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(library
(name invalid_compile_flags_test)
(inline_tests
(backend backend_foo)
(compile_flags -flag-that-is-not-accepted-by-ocaml)))
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(library
(name valid_compile_flags_test)
(inline_tests
(backend backend_foo)
(compile_flags -nolabels)))

0 comments on commit 8ad4df2

Please sign in to comment.