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.
32 lines
825 B
Text
32 lines
825 B
Text
|
||
open IO.FS
|
||
def usingIO {α} (x : IO α) : IO α := x
|
||
|
||
#eval usingIO do
|
||
let out ← IO.getStdout;
|
||
out.putStrLn "print stdout"
|
||
|
||
#eval usingIO do
|
||
let err ← IO.getStderr;
|
||
(err.putStr "print stderr" : IO Unit)
|
||
|
||
open IO
|
||
|
||
def test : IO Unit := do
|
||
FS.withFile "stdio.lean.stdout1.txt" IO.FS.Mode.write $ fun h₁ => do
|
||
{ let h₂ ← FS.Handle.mk "stdio.lean.stdout2.txt" IO.FS.Mode.write;
|
||
withStdout (Stream.ofHandle h₁) $ do
|
||
println "line 1";
|
||
tryCatch
|
||
( do
|
||
withStdout (Stream.ofHandle h₂) $ println "line 2";
|
||
throw $ IO.userError "my error" )
|
||
( fun e => println e );
|
||
println "line 3" };
|
||
println "line 4";
|
||
println "\n> stdio.lean.stdout1.txt";
|
||
readFile "stdio.lean.stdout1.txt" >>= print;
|
||
println "\n> stdio.lean.stdout2.txt";
|
||
readFile "stdio.lean.stdout2.txt" >>= print
|
||
|
||
#eval test
|