; Allow 'dune runtest' to run the tests from dune's copy of the project root.
(rule
 (alias runtest)
 (package testo)
 (deps
   test_alcotest.exe
   test.exe
   meta_test.exe
   parallel_test.exe  ; invoked by meta_test
   subtest.exe ; invoked by meta_test
   timeout_test.exe  ; invoked by meta_test
 )
 (action
   (progn
     ; The -C argument should be a path to our source project's root
     (run ./test_alcotest.exe -C ../../..)
     (run ./test.exe -C ../../..)
     (run ./meta_test.exe -C ../../..)
   )
 )
)

; Unit tests for internal modules of the Testo library
(executable
 (name test)
 (modules Test)
 (libraries
    testo
 )
)

; A dummy test suite invoked by meta-test for checking the output of testo
; programs in various situations
(executable
 (name subtest)
 (modules Subtest)
 (libraries
    fpath
    testo
 )
)

; A dummy test suite. This one fails, allowing us to check the
; quality of error reporting.
(executable
 (name failing_test)
 (modules Failing_test)
 (libraries
    testo
 )
)

; A dummy test suite used to test parallel execution
(executable
 (name parallel_test)
 (modules Parallel_test)
 (libraries
    testo
 )
)

; A dummy test suite to check that timeouts are handled correctly.
(executable
 (name timeout_test)
 (modules Timeout_test)
 (libraries
    testo
 )
)

; The test suite that exercises the dummy test suites in various ways
; and checks that it outputs what it's supposed to.
(executable
 (name meta_test)
 (modules Meta_test)
 (libraries
    testo
 )
)

; Test the export to Alcotest
(executable
 (name test_alcotest)
 (modules Test_alcotest)
 (libraries
    testo
    alcotest
 )
)
