(baseFolder: string, ...classNames: string[])
| 121 | }); |
| 122 | |
| 123 | async function testJava(baseFolder: string, ...classNames: string[]) { |
| 124 | const compiler = new JavaCompiler(info, env); |
| 125 | |
| 126 | const asm = classNames.map(className => { |
| 127 | return {text: fs.readFileSync(`${baseFolder}/${className}.asm`).toString()}; |
| 128 | }); |
| 129 | |
| 130 | const output = utils.splitLines(fs.readFileSync(`${baseFolder}/output.asm`).toString()); |
| 131 | const expectedSegments = output.map(line => { |
| 132 | const match = line.match(/^line (\d+):(.*)$/); |
| 133 | if (match) { |
| 134 | return { |
| 135 | text: match[2], |
| 136 | source: { |
| 137 | line: Number.parseInt(match[1], 10), |
| 138 | file: null, |
| 139 | }, |
| 140 | }; |
| 141 | } |
| 142 | return { |
| 143 | text: line, |
| 144 | source: null, |
| 145 | }; |
| 146 | }); |
| 147 | |
| 148 | const result = { |
| 149 | asm, |
| 150 | }; |
| 151 | |
| 152 | const processed = await compiler.processAsm(result); |
| 153 | expect(processed).toHaveProperty('asm'); |
| 154 | const asmSegments = (processed as {asm: ParsedAsmResultLine[]}).asm; |
| 155 | expect(asmSegments).toEqual(expectedSegments); |
| 156 | } |
| 157 | |
| 158 | it('should handle errors', async () => { |
| 159 | const result = { |
no test coverage detected