Commit Briefs
test.h: rename check() macro to expect() (main)
I can't remember where else I've seen this naming, but I like it because it seems to match up more neatly with assert().
put a TAB into "test() skipped" to fit regular output
This version matches project sc2 (git): commit fb675b5f860edf6266885e42d9c09c2802cf9416 from: Sven M. Hallberg <pesco@khjk.org> date: Sat Dec 28 23:46:43 2024 UTC
test.h: remove colons from output
As a side effect, this makes the test output clean TSV. This version matches project sc2 (git): commit 7e054f3208ac703dda195f3d0c49bf53e781ebc2 from: Sven M. Hallberg <pesco@khjk.org> date: Sat Dec 28 16:17:19 2024 UTC The change was initially recorded in project rx (darcs): patch 31afcfda494ef1937d8019360c9cc1ba1c4ef3c2 Author: pesco@khjk.org Date: Sat Dec 28 16:15:49 UTC 2024
include assert.h from test.h
This tweak came silently with the initial commit of project sc2 (git): commit a398e14898e509e7df5eb1648b4a28408e92eec0 from: Sven M. Hallberg <pesco@khjk.org> date: Sun Dec 8 13:37:38 2024 UTC open arrays and uinit tests
add lang/c/test.h
This is the first (2020) version, from project rx (darcs): patch e23a5d20646a06606d11f4ab711e123b4cd98ba6 Author: pesco@khjk.org Date: Mon Apr 12 15:47:51 CEST 2021 * prototype
separate run and total counters
Total is the number of tests we intend to execute. It is semantically the counter that was called 'run' before. It may increase while running test suites but is otherwise set up-front. Run is now the number of tests we have so far (at least tried) to execute and increments as we go. It will normally be the sum of ok, fail, and error. If and when we add parallel execution of tests, the sum might lag behind because 'run' gets incremented before the test is finished. Counter consistency gains the requirement that run not exceed total. At the same time, it is relaxed such that run may end lower than total. Thus test suites (or exercise itself) may abort early (after the first failure, say) without such a run being considered invalid. This commit includes two new tests and fixes some bugs they exposed.
assert-exercise: remove tempfiles via an exit trap
This ensures it happens also on a premature exit (127).
more getopt improvements
Set arg variable to 1 for boolean flags.
add command line options for patterns
Includes a minimal getopt(3) implementation.
improve counter colors in corner cases
Color "ok" green only if positive. Color "run" dark red if zero.
change default test/suite/dir patterns to *.t, *.tests, *, respectively
The file patterns should be suffixes so they become hidden if there is another, like on a source file for a test, for instance. NB: The directory pattern only applies to directories, it will not cause regular files to be mistaken for subdirectories. Widening it to all directories is done in anticipation of introducing a -C command line option. The executable patterns also only apply to regular files.
add README/manpage, Makefile
Makefile generates README from the manpage.