Perform a runtime checking transformation test case.
(self, testcase: DataDrivenTestCase)
| 33 | base_path = test_temp_dir |
| 34 | |
| 35 | def run_case(self, testcase: DataDrivenTestCase) -> None: |
| 36 | """Perform a runtime checking transformation test case.""" |
| 37 | with use_custom_builtins(os.path.join(self.data_prefix, ICODE_GEN_BUILTINS), testcase): |
| 38 | expected_output = remove_comment_lines(testcase.output) |
| 39 | try: |
| 40 | ir = build_ir_for_single_file(testcase.input) |
| 41 | except CompileError as e: |
| 42 | actual = e.messages |
| 43 | else: |
| 44 | actual = [] |
| 45 | for fn in ir: |
| 46 | if fn.name == TOP_LEVEL_NAME and not testcase.name.endswith("_toplevel"): |
| 47 | continue |
| 48 | insert_uninit_checks(fn, True) |
| 49 | insert_exception_handling(fn, True) |
| 50 | insert_ref_count_opcodes(fn) |
| 51 | actual.extend(format_func(fn)) |
| 52 | if testcase.name.endswith("_freq"): |
| 53 | common = frequently_executed_blocks(fn.blocks[0]) |
| 54 | actual.append("hot blocks: %s" % sorted(b.label for b in common)) |
| 55 | |
| 56 | assert_test_output(testcase, actual, "Invalid source code output", expected_output) |
nothing calls this directly
no test coverage detected