On 08/16/2009 07:16 PM, Eduardo Cavazos wrote:

Below is a note I sent to the Ikarus Scheme list today regarding usage
of SRFI-64. If you have any input, let me know!

Per Bothner wrote:

The reference implementation of srfi-64 contains some extra
Kawa-specific magic which makes things quite a bit nicer.
These are controlled by
  (cond-expand (kawa ...) (else ...))
(There are also some conditionals that depend on other srfis.)

You might consider implementing similar hooks for Ikarus.  If you
have any questions about what is needed, feel free to ask.
I'll be happy to merge them into the reference implementation.

Per,

What I'm thinking of doing is using something like the 'check-assert' syntax below, which uses the expr as the "test name" passed to 'test-assert'.

----------------------------------------------------------------------
(import (rnrs)
        (srfi :64))

(define-syntax check-assert
  (syntax-rules ()
    ((check-assert expr)
     (test-assert 'expr expr))))

(test-begin "math-examples")

(check-assert (number? 5))

(check-assert (number? 'x))

(test-end "math-examples")
----------------------------------------------------------------------

This is the result of running that script with Ikarus:

~ # ikarus --r6rs-script /scratch/_srfi-64-example-syntax-a.scm
%%%% Starting test math-examples
FAIL (number? 'x)
# of expected passes      1
# of unexpected failures  1
~ #

By the way, PLT comes with an implementation of SRFI-64. If I run the original script:

----------------------------------------------------------------------
(import (rnrs)
        (srfi :64))

(test-begin "math-examples")

(test-assert (number? 5))

(test-assert (number? 'x))

(test-end "math-examples")
----------------------------------------------------------------------

with PLT, the results are closer to what you showed:

----------------------------------------------------------------------
~ # plt-r6rs /scratch/_srfi-64-example-a.scm
%%%% Starting test math-examples  (Writing full log to "math-examples.log")
/scratch/_srfi-64-example-a.scm:9: FAIL
# of expected passes      1
# of unexpected failures  1
~ #
----------------------------------------------------------------------

where 'math-examples.log' is:

----------------------------------------------------------------------
~ # cat math-examples.log
%%%% Starting test math-examples
Group begin: math-examples
Test begin:
  source-file: "/scratch/_srfi-64-example-a.scm"
  source-line: 7
  source-form: (test-assert (number? 5))
Test end:
  actual-value: #t
  result-kind: pass
Test begin:
  source-file: "/scratch/_srfi-64-example-a.scm"
  source-line: 9
  source-form: (test-assert (number? (quote x)))
Test end:
  actual-value: #f
  result-kind: fail
Group end: math-examples
# of expected passes      1
# of unexpected failures  1
~ #
----------------------------------------------------------------------

Ed

Reply via email to