tests/functional2: migrate debugger.sh

Change-Id: I82c5b739db09530ff216c91608be2f70a2036e11
This commit is contained in:
Commentator2.0
2025-10-18 11:23:43 +00:00
committed by Rutile
parent e8d281eac6
commit 4fcfdc66fe
3 changed files with 29 additions and 14 deletions
+29
View File
@@ -0,0 +1,29 @@
import re
from textwrap import dedent
from functional2.testlib.fixtures.nix import Nix
def test_regression_9932(nix: Nix):
cmd = nix.nix(["eval", "--debugger", "--expr", '(_: throw "oh snap") 42'], flake=True)
cmd.with_stdin(b":env")
res = cmd.run().expect(1)
assert "error: oh snap" in res.stderr_plain
def test_debugger_output(nix: Nix):
expr = dedent("""
let x.a = 1; in
with x;
(_: builtins.seq x.a (throw "oh snap")) x.a
""")
res = (
nix.nix(["eval", "--debugger", "--expr", expr], flake=True)
.with_stdin(b":env\n")
.run()
.expect(1)
)
assert "error: oh snap" in res.stderr_plain
assert re.findall(r"with: .*a", res.stdout_plain)
assert re.findall(r"static: .*x", res.stdout_plain)