Type check binary expressions

This commit is contained in:
2024-05-28 23:39:04 +02:00
parent 83c16e7ad9
commit 7845c700d8
10 changed files with 158 additions and 11 deletions

View File

@ -32,11 +32,13 @@ async function compileTest (parsedPath) {
})
}
function checkFailure (parsedPath, buildResult) {
async function checkFailure (parsedPath, buildResult) {
const failureFile = path.resolve('./tests/failures', `${parsedPath.name}.txt`)
await fs.access(failureFile)
const diffArguments = [
'-u', '--color=always',
path.resolve('./tests/failures', `${parsedPath.name}.txt`),
'-'
failureFile, '-'
]
try {
@ -97,16 +99,22 @@ async function runVM(cpioImage) {
async function runInDirectory (directoryPath) {
let failed = 0
const sources = await glob(path.join(directoryPath, '*.eln'))
for (const testEntry of await glob(path.join(directoryPath, '*.eln'))) {
for (const testEntry of sources) {
const parsedPath = path.parse(testEntry)
console.log(`Compiling ${parsedPath.base}.`)
const buildResult = await compileTest(parsedPath)
if (buildResult.code !== 0) {
if (!(await checkFailure(parsedPath, buildResult))) {
try {
if (!(await checkFailure(parsedPath, buildResult))) {
++failed
}
} catch (e) {
++failed
console.log(buildResult.output)
}
continue
}
@ -119,7 +127,7 @@ async function runInDirectory (directoryPath) {
await runVM(cpioImage)
return {
total: (await glob(path.join(directoryPath, 'failures/*'))).length,
total: sources.length,
failed,
passed () {