Files
lix/tests/functional2/eval/test_debugger.py
T
Commentator2.0 4fcfdc66fe tests/functional2: migrate debugger.sh
Change-Id: I82c5b739db09530ff216c91608be2f70a2036e11
2025-10-18 11:23:43 +00:00

30 lines
794 B
Python

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)