@@ -123,18 +123,29 @@ def test_a_long_read_response_is_copied_whole_into_an_artifact(captured):
123123 assert str (files [0 ]) in captured [- 1 ]
124124
125125
126- def test_a_bash_call_under_the_formatted_threshold_is_dropped_whole (captured ):
127- assert "fewer than 30 characters on a single stream" in _paragraph ()
128- kept = _number_before ("characters on a single stream" )
129- command = "grep 'Alice Martin' a.csv"
126+ _BASH = {"command" : "grep 'Alice Martin' a.csv" }
127+
128+
129+ def _capture_bash (captured , response : dict ) -> bool :
130+ before = len (captured )
131+ hook .process_event (_event ("Bash" , _BASH , response ))
132+ return len (captured ) > before and "Alice Martin" in captured [- 1 ]
133+
134+
135+ def test_a_bash_call_on_one_stream_is_kept_from_the_stated_length (captured ):
136+ assert "A call that prints nothing is always dropped" in _paragraph ()
137+ kept = _number_before ("characters of output; two streams" )
130138 for stream in ("stdout" , "stderr" ):
131- hook .process_event (
132- _event ("Bash" , {"command" : command }, {stream : "x" * (kept - 1 )})
133- )
134- hook .process_event (_event ("Bash" , {"command" : command }, {stream : "" }))
135- assert captured == []
136- hook .process_event (_event ("Bash" , {"command" : command }, {"stdout" : "x" * kept }))
137- assert len (captured ) == 1 and "Alice Martin" in captured [- 1 ]
139+ assert not _capture_bash (captured , {stream : "x" * (kept - 1 )})
140+ assert _capture_bash (captured , {stream : "x" * kept })
141+ assert not _capture_bash (captured , {"stdout" : " " , "stderr" : "" })
142+ assert not _capture_bash (captured , {"stdout" : "" , "interrupted" : True })
143+
144+
145+ def test_two_streams_or_an_interruption_are_kept_with_less_output (captured ):
146+ assert "two streams or an interrupted marker can reach 50" in _paragraph ()
147+ assert _capture_bash (captured , {"stdout" : "ok" , "stderr" : "warn: x" })
148+ assert _capture_bash (captured , {"stdout" : "12345678" , "interrupted" : True })
138149
139150
140151def test_a_one_character_edit_is_captured_with_its_path (captured ):
0 commit comments