@@ -248,29 +248,12 @@ def run_cases_test(self, input: str, expected: str):
248248 )
249249
250250 with open (self .temp_output_filename ) as temp_output :
251- lines = temp_output .readlines ()
252- while lines and lines [0 ].startswith (("// " , "#" , " #" , "\n " )):
253- lines .pop (0 )
254- while lines and lines [- 1 ].startswith (("#" , "\n " )):
255- lines .pop (- 1 )
256- while lines and tier1_generator .INSTRUCTION_START_MARKER not in lines [0 ]:
257- lines .pop (0 )
258- lines .pop (0 )
259- for instruction_end_marker_index , line in enumerate (lines ):
260- if tier1_generator .INSTRUCTION_END_MARKER in line :
261- break
262- else :
263- assert False , "No instruction end marker found."
264- for label_start_marker_index , line in enumerate (lines ):
265- if tier1_generator .LABEL_START_MARKER in line :
266- break
267- else :
268- assert False , "No label start marker found."
269- del lines [instruction_end_marker_index :label_start_marker_index + 1 ]
270- # Pop the label markers themselves
271- lines .pop (0 )
272- lines .pop (- 1 )
273- actual = "" .join (lines )
251+ lines = temp_output .read ()
252+ _ , rest = lines .split (tier1_generator .INSTRUCTION_START_MARKER )
253+ instructions , labels_with_prelude_and_postlude = rest .split (tier1_generator .INSTRUCTION_END_MARKER )
254+ _ , labels_with_postlude = labels_with_prelude_and_postlude .split (tier1_generator .LABEL_START_MARKER )
255+ labels , _ = labels_with_postlude .split (tier1_generator .LABEL_END_MARKER )
256+ actual = instructions + labels
274257 # if actual.strip() != expected.strip():
275258 # print("Actual:")
276259 # print(actual)
0 commit comments