Arc Forumnew | comments | leaders | submitlogin
2 points by fallintothis 1409 days ago | link | parent

Actually, stdout should be easy to test with tostring, no?

In fact, if you're just testing REPL interactions...

  (mac repl-output (expr)
       (write (eval ',expr))

  arc> (repl-output (prn 'hi))
  arc> (repl-output (prn "hi"))
  arc> (repl-output 'hi)
  arc> (repl-output (do prn.1 prn.2 prn.3))
(Any gotchas with the above?)

It makes sense to specify the example expr / expected pairs as sexps & strings: run repl-output on exprs, compare those strings to the expected strings.

2 points by akkartik 1408 days ago | link

Thanks for thinking through that! Yes, I'd had a similar though not as fully-formed idea, but was stuck on distinguishing stdout from return value in the examples. But yeah, that's overthinking it -- we have to mentally parse the two at the repl anyway.

Only other quibble: a string isn't very nice to read next to code, even if it looks nice at the repl. Hmm..