commit f22b78bb4f965897447b30faa45acd815cba886b from: Sven M. Hallberg date: Thu Jun 26 11:48:40 2025 UTC document -B and -C options commit - 9a51a4f9a4d3b07e859786042208a46c9d630566 commit + f22b78bb4f965897447b30faa45acd815cba886b blob - 88df12a079d2f7743ffca4c6d8d3f1f9dab9f3de blob + 17f23adf74f0d3a17bcc3c14884f409dcaa56aa7 --- exercise.1 +++ exercise.1 @@ -9,6 +9,8 @@ .Sh SYNOPSIS .Nm exercise .Op Fl q +.Op Fl B Ar dir +.Op Fl C Ar dir .Op Fl p Ar k Ns Sy = Ns Ar pattern .Op Ar path ... . @@ -30,6 +32,21 @@ To be run as test suites (see below), files must match .Pp The options are as follows: .Bl -tag -width Ds +.It Fl B Ar dir +Find test files relative to the given directory. +This effectively applies a prefix to any +.Ar path +arguments. +If +.Ar dir +is a relative path, +it applies to the working directory in effect after any +.Fl C +option. +.It Fl C Ar dir +Change the working directory to +.Ar dir +before doing anything else. .It Fl p Sy d= Ns Ar pattern When searching for tests, only descend into directories that match the given pattern. @@ -167,8 +184,24 @@ directory distributed with the program. It shows a useful idiom where a number of test (shell) scripts make use of a helper, .Pa assert-exercise . -The helper runs exercise with some test (shell) script to execute and compares +The helper runs +.Nm +with some test (shell) script to execute and compares the outcome to expectations. +.Pp +An example use of the +.Fl B +option is to change (with +.Fl C ) +into a directory containing some helper files +and then to use +.Fl B Pa .. +(for instance) +to point back to the top-level test directory. +This way +.Ar path +arguments can be used normally +but tests find the helper files in their current working directory. . .Sh SEE ALSO .Xr sh 1