This PR sets up the new integrated test/bench suite. It then migrates all benchmarks and some related tests to the new suite. There's also some documentation and some linting. For now, a lot of the old tests are left alone so this PR doesn't become even larger than it already is. Eventually, all tests should be migrated to the new suite though so there isn't a confusing mix of two systems.
29 lines
681 B
Text
29 lines
681 B
Text
import Std.Sync.Channel
|
|
|
|
open IO
|
|
|
|
-- not in the run/ directory because then it would be run with -j0
|
|
|
|
#eval do
|
|
let promise ← Promise.new
|
|
promise.resolve 42
|
|
assert! promise.result?.get = some 42
|
|
|
|
|
|
/- Dropping a promise resolves `result?` to `none`. -/
|
|
#eval do
|
|
let promise : Promise Nat ← Promise.new
|
|
assert! promise.result?.get = none
|
|
|
|
#eval show IO _ from do
|
|
let ch ← Std.CloseableChannel.new
|
|
|
|
let out ← IO.mkRef #[]
|
|
ch.sync.send 0
|
|
let drainFinished ← ch.forAsync fun x => out.modify (·.push x)
|
|
ch.sync.send 1
|
|
ch.close
|
|
assert! (← EIO.toBaseIO (ch.sync.send 2)) matches .error .closed
|
|
|
|
IO.wait drainFinished
|
|
assert! (← out.get) = #[0, 1]
|