How to check throwing errors in a racket?

Currently, I work in some racket programs, in particular in PLAI language. Programming languages: application and interpretation. A book, and there is a function called test, I was wondering how to check the error throwing a racket? Does anyone know how to do this?

Hi

(I am not a native speaker of English, I hope this question can be understood)

+6
testing racket
source share
1 answer

There is test/exn that you can use to check for error messages, for example:

 (test/exn (error "foo") "foo") 

but note that the docs indicate that it can only test those exceptions that were explicitly affected by your code. The idea is that your code should check for errors and raise them, otherwise you have an error.

(For testing the "real" racket code, see rackunit .

+7
source share

All Articles