2 ms·
Ever since Elixir 1.12, which introduced the `Mix.install[..]` at the beginning of the script, Elixir has been awesome for this sort of thing. Prior to that, it
by losvedir 3y ago
Ever since Elixir 1.12, which introduced the `Mix.install[..]` at the beginning of the script, Elixir has been awesome for this sort of thing. Prior to that, it just wasn't worth it.
I'm surprised the testing worked like that, without trying myself. When I last fiddled with it, I stole a page from how they recommend you do it in Livebook, and had `ExUnit.start(autorun: false)` at the top and `ExUnit.run()` at the bottom. I didn't realize you could just `ExUnit.start()` by itself up front.
For anyone else who's tried an approach like this, have you managed to get doctests to work? I really like them, and think they're especially appropriate where you probably want lots of examples like here, but haven't been able to figure out how to stick them in ad-hoc scripts like this. I get some issue about the code not being compiled and available.