On Thu, Aug 20, 2020 at 4:04 PM Marc Nieper-Wißkirchen <xxxxxx@nieper-wisskirchen.de> wrote:
 
Unfortunately, there are some incompatibilities: "test-error" has a
different interface; SRFI 64 has "test-equal", Chibi/Chicken has
"test".

In fact, C/C `test` is more sophisticated.  This is not an attack on SRFI-64: everything has to begin somewhere.

In C/C, `test` defaults to using the `test-equal?` predicate (also exported), which uses `equal?` unless both arguments are inexact, in which case a relative-error test is applied.  You can set the max relative error with a parameter, and you can replace the whole equality predicate with another parameter.  In that way it subsumes 64's `test-equal`, `test-eqv`, `test-eq`, and `test-approximate`, as well as a vast number of other possibilities in a way that does not hide information.  For example, I have set the equality-predicate parameter to string-ci=? in some tests. With SRFI 64 I'd have to wrap the arguments in string-fold (or failing that, string-lower). If they don't match, the report conceals the true actual and expected values.

So I don't think, in fact, that you can layer C/C over 64, though the converse is true (as far as tests go).  You could kludge around the problem by only allowing certain values of the parameters (e.g. checking whether the value of current-test-comparator was a function known to 64), but ugh.

SRFI 64's `test-error` is better in principle than C/C's, though the use of it is likely to be less portable unless the exceptions being raised are documented and exported.  Probably an approach that made the condition predicate optional would be a good enhancement to C/C.

The test-runner macros of C/C are test-begin, test-end, test-group, and test-exit; IMO only the last two are necessary.  There are a bunch more parameters that control the test runner.

Finally, C/C has nothing to test for lexical syntax issues, but that's a marginal thing to do: most programs and libraries don't introduce new lexical syntax, and most Scheme's don't even *have* extensible lexical syntax.





John Cowan          http://vrici.lojban.org/~cowan        xxxxxx@ccil.org
But no living man am I!  You look upon a woman.  Eowyn I am, Eomund's daughter.
You stand between me and my lord and kin.  Begone, if you be not deathless.
For living or dark undead, I will smite you if you touch him.