[racket] plai test/exn

6 views
Skip to first unread message

Jeremy Kun

unread,
Sep 19, 2011, 4:47:05 PM9/19/11
to us...@racket-lang.org
Not sure if this is a bug, but it doesn't match the documentation here. It says test/exn only succeeds when the error is explicitly raised by the user, but I try something as simple as:

"file1.rkt"
(provide foo)
(define (foo) (error "hello"))

"file2.rkt"
(require plai "file1.rkt")
(test/exn (foo) "hello")

and the test fails with "no expected value". I can even replace "hello" with a call to error, and see that that argument is never evaluated. So by user-written code, I'm assuming they mean code contained in the same module. Or am I missing something fundamental about Racket's idea of "user-written code"?

Jeremy

John Clements

unread,
Sep 19, 2011, 5:49:16 PM9/19/11
to Jeremy Kun, us...@racket-lang.org

Just a quick look, but it looks like you're failing to thunk the arguments to test/exn, so it never even gets control.

John

Eric Dobson

unread,
Sep 19, 2011, 5:57:40 PM9/19/11
to John Clements, us...@racket-lang.org, Jeremy Kun
Also IIRC test/exn only works on errors raised using 'error' from
PLAI, which is different from 'error' from racket/base.

-Eric

> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>

_________________________________________________
For list-related administrative tasks:
http://lists.racket-lang.org/listinfo/users

John Clements

unread,
Sep 19, 2011, 5:59:32 PM9/19/11
to Eric Dobson, us...@racket-lang.org, Jeremy Kun

On Sep 19, 2011, at 2:57 PM, Eric Dobson wrote:

> Also IIRC test/exn only works on errors raised using 'error' from
> PLAI, which is different from 'error' from racket/base.

Ooh, just saw that this was test/exn, not check/exn. I retract my hasty comment!

John

Jay McCarthy

unread,
Sep 19, 2011, 6:12:32 PM9/19/11
to Eric Dobson, us...@racket-lang.org, John Clements, Jeremy Kun
And that's what it means by "user code"

Jay

--
Jay McCarthy <j...@cs.byu.edu>
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay

"The glory of God is Intelligence" - D&C 93

Jeremy Kun

unread,
Sep 19, 2011, 6:21:27 PM9/19/11
to Jay McCarthy, us...@racket-lang.org, John Clements
Ah! Why don't they state that they shadow "error" in the documentation? Isn't that considered bad form? And worse, undocumented bad form!

Everything I was taught in school by idealistic Racket programmers is crashing down before my eyes! I might as well be coding in C. 

But seriously, this should be in the docs.

Jeremy

Eric Dobson

unread,
Sep 19, 2011, 6:24:44 PM9/19/11
to Jeremy Kun, Jay McCarthy, us...@racket-lang.org, John Clements
I found it immediately by searching for error on docs.racket-lang.org,
and going to the plai entry.

http://docs.racket-lang.org/plai/plai-scheme.html?q=error#(def._((lib._plai/main..rkt)._error))

Is there some other place you would expect it to be?

(It does need some scheme->racket cleanup though)

-Eric

Reply all
Reply to author
Forward
0 new messages