MCPcopy Index your code
hub / github.com/compiler-explorer/compiler-explorer / testJava

Function testJava

test/java-tests.ts:123–156  ·  view source on GitHub ↗
(baseFolder: string, ...classNames: string[])

Source from the content-addressed store, hash-verified

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 = {

Callers 1

java-tests.tsFile · 0.85

Calls 4

processAsmMethod · 0.95
toStringMethod · 0.80
splitLinesMethod · 0.80
matchMethod · 0.80

Tested by

no test coverage detected