lean4-htt/tests/elab/realPath.lean
Garmelon 08eb78a5b2
chore: switch to new test/bench suite (#12590)
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.
2026-02-25 13:51:53 +00:00

27 lines
934 B
Text

/-!
Tests that the `IO.FS.realPath` function on windows resolves links.
-/
/-
Note: The test below circumvents #8547 by misusing quotation marks in order to run `mklink`.
This test will need to be updated once that issue is fixed.
-/
def realPathTest : IO Unit := do
unless System.Platform.isWindows do
return
let dir ← IO.currentDir
let tmpDir := dir / "tmp_realpath_test_dir"
let tmpJunct := dir / "tmp_realpath_test_junction"
IO.FS.createDir (dir / tmpDir)
let cmd := "cmd.exe\" /c mklink /j \"" ++ tmpJunct.toString ++ "\" \"" ++ tmpDir.toString
discard <| IO.Process.run { cmd }
let realPath1 ← IO.FS.realPath tmpDir
let realPath2 ← IO.FS.realPath tmpJunct
IO.FS.removeDir tmpJunct
IO.FS.removeDir tmpDir
IO.println s!"{realPath1} vs {realPath2}"
if realPath1 != realPath2 then
throw (.userError ("mismatch " ++ realPath1.toString ++ " with " ++ realPath2.toString))
#eval realPathTest