skapata has quit [Remote host closed the connection]
Tuplanolla has joined #racket
to-hu has joined #racket
wonko-th1-sane has joined #racket
wonko-the-sane has quit [Ping timeout: 246 seconds]
dhil has joined #racket
dhil has quit [Ping timeout: 255 seconds]
wonko-th1-sane has quit [Ping timeout: 246 seconds]
wonko-the-sane has joined #racket
to-hu has quit [Remote host closed the connection]
wonko-the-sane has quit [Ping timeout: 246 seconds]
ncf has quit [Ping timeout: 240 seconds]
ncf has joined #racket
skapata has joined #racket
wonko-the-sane has joined #racket
ashpool has joined #racket
<ashpool>
I have a very simple s-exp-based DSL implemented in Racket. What's the best way to write a test-suite for it using rackunit? I have customized #%module-begin, and I want to test the values it returns.
<ashpool>
I've studied namespaces and sandboxed evaluation for a few days, and I've kind of made it work, but it's very ugly and I have a feeling in must be much much simpler than that.
<ashpool>
I would love to look at some code samples for what a test suite might look like, if available.
<ashpool>
I'm dynamic-requiring a module, and when I do that, a value is printed to the standard output. How do I get hold of that value in "rade-test.rkt" so I can write tests against it? (dynamic-require) itself returns void.
<bremner>
hmm. Can with-output-to-string help?
<bremner>
I don't really know anything about dynamic-require.
<ashpool>
I could modify the language so that it exports a value, say 'result, and then do (dynamic-require '(submod "rade-test.rkt" zzz) 'result). But what if I don't want to export anything? And what if I need to do the same for a non-s-exp-based language?
wonko-the-sane has quit [Ping timeout: 246 seconds]
<bremner>
I basically only use (module+ test ...)
<ashpool>
Yeah that's a good idiom but unfortunately my language is so minimalistic it doesn't provide things like (module... ). So I need to write a separate module in racket, make it have a test submodule, and in that submodule dynamically require and test the program in DSL. At least that's how I see it.
wonko-the-sane has joined #racket
dhil has joined #racket
monkey_ has joined #racket
wonko-the-sane has quit [Ping timeout: 246 seconds]
wonko-the-sane has joined #racket
monkey_ has quit [Ping timeout: 255 seconds]
monkey_ has joined #racket
monkey_ has quit [Remote host closed the connection]