[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

proosal: removing test-result objects

As discussed in past messages, I'm leaning towords removing the
concept of a test-result "value", which in the current specification
is an association list.  Instead, I think it is better to make the
"most recent test-result" be part of the test-runner, and allow
extra properties there.

Specifically, we add:

;; Get a named property - #f if unknown.
(test-result [runner] 'property-name)
These are properties of the current or most recent test.

(test-result 'kind) -> one of 'pass, 'xpass, 'fail, 'xfail, or 'skip.
(test-passed?) -> same as (memq (test-result 'kind) '(pass xpass))
(test-result 'source-line) -> line number if known or #f otherwise
(test-result 'source-filename) -> file name known or #f otherwise
(test-result 'source-form) -> test expresion as a list or #f
(test-result 'test-name) -> test name or #f

(test-result-set! [runner] 'property-name value) ;; set property

(test-result-clear! [runner])
This is called internally at the start of a test to reset the
test-result state.  Specifically, all properties set by
test-result-set! are cleared.

The function on-test in (test-runner-on-test! runner on-test)
is now a 1-argument function that only takes a test-runner.
It gets the "test-result" from the test-runner.

Note that both test-cases and test-runner can examine these
properties.  For example (test-passed?) can be used to decide
whether to skip subsequent tests.

I also thing it simplies the implementation and api.  We can
set properties at various statges during the execution of a test.

Comments?  Does this seem like an improvement?
	--Per Bothner
per@xxxxxxxxxxx   http://per.bothner.com/