This PR migrates most remaining tests to the new test suite. It also completes the migration of directories like `tests/lean/run`, meaning that PRs trying to add tests to those old directories will now fail.
31 lines
1 KiB
Text
31 lines
1 KiB
Text
import Lean.Data.Lsp
|
|
open IO Lean Lsp
|
|
|
|
def main : IO Unit := do
|
|
Ipc.runWith "lean" #["--server"] do
|
|
let hIn ← Ipc.stdin
|
|
hIn.write (←FS.readBinFile "init_vscode_1_47_2.log")
|
|
hIn.flush
|
|
discard $ Ipc.readResponseAs 0 InitializeResult
|
|
Ipc.writeNotification ⟨"initialized", InitializedParams.mk⟩
|
|
|
|
hIn.write (←FS.readBinFile "open_content.log")
|
|
hIn.flush
|
|
discard <| Ipc.collectDiagnostics 1 "file:///test.lean" 1
|
|
|
|
hIn.write (←FS.readBinFile "content_changes.log")
|
|
hIn.flush
|
|
|
|
let some diag ← Ipc.collectDiagnostics 2 "file:///test.lean" 7
|
|
| throw $ userError "Test failed, no diagnostics received."
|
|
FS.writeFile "edits_diag.json.produced" (toString <| toJson (diag : JsonRpc.Message))
|
|
|
|
if let Except.ok (refDiag : JsonRpc.Notification PublishDiagnosticsParams) :=
|
|
(Json.parse $ ←FS.readFile "edits_diag.json") >>= fromJson?
|
|
then
|
|
assert! (diag == refDiag)
|
|
else
|
|
throw $ userError "Failed parsing test file."
|
|
|
|
Ipc.shutdown 3
|
|
discard $ Ipc.waitForExit
|