From 344ccb9f09d04f492865ac8d8838a3ecc2e73774 Mon Sep 17 00:00:00 2001 From: Ajani Bilby <11359344+AjaniBilby@users.noreply.github.com> Date: Wed, 29 May 2024 15:46:19 +1000 Subject: [PATCH] cleaned up test logs --- package.json | 2 +- source/compiler/package.ts | 6 +++--- source/test.ts | 17 ++++++++--------- tests/.gitignore | 1 + tests/{reflective => }/fibonacci.test.sa | 0 tests/{reflective => }/numeric.test.sa | 6 +++--- tests/reflective/.gitignore | 1 - 7 files changed, 16 insertions(+), 17 deletions(-) create mode 100644 tests/.gitignore rename tests/{reflective => }/fibonacci.test.sa (100%) rename tests/{reflective => }/numeric.test.sa (88%) delete mode 100644 tests/reflective/.gitignore diff --git a/package.json b/package.json index 6dd7e81..dcaaa1d 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "build:compiler": "deno compile --output salient.exe -A ./source/cli.ts", "test": "run-s test:*", "test:deno": "deno test", - "test:reflect": "npm run sa-test ./tests/reflective", + "test:reflect": "npm run sa-test ./tests", "cli": "deno run -A ./source/cli.ts", "sa-test": "deno run -A ./source/cli.ts test", "compile": "deno run -A ./source/cli.ts compile" diff --git a/source/compiler/package.ts b/source/compiler/package.ts index f2a2794..a18bfe3 100644 --- a/source/compiler/package.ts +++ b/source/compiler/package.ts @@ -1,4 +1,4 @@ -import { dirname, relative } from "https://deno.land/std@0.201.0/path/mod.ts"; +import { relative } from "https://deno.land/std@0.201.0/path/mod.ts"; import type Project from "~/compiler/project.ts"; import { File } from "~/compiler/file.ts" @@ -11,13 +11,13 @@ export default class Package { failed: boolean; - constructor(project: Project, base: string, name: string = "~") { + constructor(project: Project, base: string, name = "~") { this.project = project; this.failed = false; this.files = []; this.name = name; - this.cwd = dirname(base); + this.cwd = base; } import(filePath: string) { diff --git a/source/test.ts b/source/test.ts index f1590c0..881fd2d 100644 --- a/source/test.ts +++ b/source/test.ts @@ -8,8 +8,6 @@ import TestCase from "~/compiler/test-case.ts"; import Package from "~/compiler/package.ts"; import Project from "~/compiler/project.ts"; - - export async function Test() { // Determine all of the files to test const targets = Deno.args.length > 1 @@ -37,7 +35,8 @@ export async function Test() { const index = new Array(); - console.log("Compiling..."); + console.log("Compilation"); + const compStart = Date.now(); for (const path of files.values()) { const file = mainPck.import(path); @@ -48,10 +47,10 @@ export async function Test() { index.push(test); } } + const compEnd = Date.now(); if (project.failed) Deno.exit(1); - - + console.log(` Found and compiled ${index.length} test cases ${colors.gray(`(${compEnd-compStart}ms)`)}`) // Run all of the tests @@ -61,13 +60,13 @@ export async function Test() { let fails = 0; const exports = instance.exports; let prev = ""; - const start = Date.now(); + const execStart = Date.now(); for (let i=0; i