Skip to content

Commit f41be4b

Browse files
committed
Feature(tests): Run all programms & support stdout testing
1 parent 97a4ad7 commit f41be4b

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

tests/runner.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,20 @@ async function main() {
2626
]);
2727

2828
console.log(compileLog.toString());
29+
30+
const stdoutExecution = execFileSync(path.join(__dirname, '..', 'output', 'main'));
31+
32+
if (fs.existsSync(path.join(`${testFile}.stdout`))) {
33+
const expectedStdout = fs.readFileSync(path.join(`${testFile}.stdout`));
34+
35+
if (expectedStdout.toString() != stdoutExecution.toString()) {
36+
console.log('Unexpected stdout');
37+
console.log(stdoutExecution.toString());
38+
console.log(expectedStdout.toString());
39+
40+
process.exit(1);
41+
}
42+
}
2943
}
3044
} catch (error) {
3145
console.log(error.output.toString());

0 commit comments

Comments
 (0)