Skip to content

Commit 0983f29

Browse files
committed
doc(test/README): add usage information
This commit adds the following usage information to README.md and implements the described functionality in test/main.f90: Executing `fpm test -- --help` prints the following message: Usage: fpm test -- [--help] | [--contains <substring>] where square brackets ([]) denote optional arguments, a pipe (|) separates alternative arguments, angular brackets (<>) denote a user-provided value, and passing a substring limits execution to the tests with test subjects or test descriptions containing the user-specified substring.
1 parent 296adf9 commit 0983f29

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@ git clone [email protected]:sourceryinstitute/sourcery
8282

8383
Building and Testing
8484
--------------------
85+
### Test-Suite Usage
86+
Executing `fpm test -- --help` prints the following message:
87+
```
88+
Usage: fpm test -- [--help] | [--contains <substring>]
89+
90+
where square brackets ([]) denote optional arguments, a pipe (|) separates alternative arguments,
91+
angular brackets (<>) denote a user-provided value, and passing a substring limits execution to
92+
the tests with test subjects or test descriptions containing the user-specified substring.
93+
```
94+
8595
### Single-image (serial) testing with GNU Fortran (`gfortran`)
8696
With recent versions of [GNU Fortran] (gfortran) and [OpenCoarrays] installed,
8797
execute the following command in a `zsh` or `bash`-like shell:

test/main.f90

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ program main
77
use test_result_test_m, only : test_result_test_t
88
use command_line_test_m, only : command_line_test_t
99
use string_test_m, only : string_test_t
10+
use sourcery_m, only : command_line_t
1011
implicit none
1112

1213
type(collectives_test_t) collectives_test
@@ -20,6 +21,18 @@ program main
2021

2122
integer :: passes=0, tests=0
2223

24+
block
25+
type(command_line_t) command_line
26+
character(len=*), parameter :: usage = &
27+
new_line('') // new_line('') // &
28+
'Usage: fpm test -- [--help] | [--contains <substring>]' // &
29+
new_line('') // new_line('') // &
30+
'where square brackets ([]) denote optional arguments, a pipe (|) separates alternative arguments,' // new_line('') // &
31+
'angular brackets (<>) denote a user-provided value, and passing a substring limits execution to' // new_line('') // &
32+
'the tests with test subjects or test descriptions containing the user-specified substring.' // new_line('')
33+
if (command_line%argument_present([character(len=len("--help"))::"--help","-h"])) stop usage
34+
end block
35+
2336
call bin_test%report(passes, tests)
2437
call data_partition_test%report(passes, tests)
2538
call collectives_test%report(passes, tests)

0 commit comments

Comments
 (0)