guile-user
[Top][All Lists]
Advanced

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

SRFI 64: How do I create a test-runner stub


From: sirgazil
Subject: SRFI 64: How do I create a test-runner stub
Date: Thu, 7 Mar 2019 16:02:37 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1

Hello,

I'm trying to implement a procedure that takes a test-runner object and returns a string with information about the most recently run test. For example, calling

(format-test-result (make-runner #:test-name "A is not B." #:result-kind 'fail))

is expected to return:

  ✖ FAIL A is not B.

In the example, `make-runner` is a procedure that is supposed to create a test-runner stub with the given values, so that I can test the `format-test-result` procedure.

I thought I could define `make-runner` body like this:

  (let ((runner-stub (test-runner-null)))
    (test-runner-test-name! runner-stub test-name)
    (test-result-set! runner-stub 'result-kind result-kind)
    stub-runner))

The problem is, the `test-runner-test-name!` setter does not exist. And test-runner objects don't seem to have a `test-name` slot. They do provide a `test-runner-test-name` getter, though.

So I don't know how to create a test-runner stub to test my procedure.

What would you do in this case?


--
Luis Felipe López Acevedo
http://sirgazil.bitbucket.io/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]