Skip to content

Commit

Permalink
admin: tweaked gitignore for misc files
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed May 18, 2023
1 parent bcca632 commit c845357
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
node_modules/**
output/**
misc/**

**/*.swp
**/*.tgz
Expand Down
3 changes: 3 additions & 0 deletions misc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.txt
tests/**
obsolete/**
23 changes: 12 additions & 11 deletions misc/test-browser/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,19 @@
function throwError(message, info) {
const error = new Error(`AssertionError: ${ message }`);
error.code = "ERR_ASSERTION";
for (const key of info) { error[key] = info[key]; }
for (const key in info) { error[key] = info[key]; }
throw error;
}

export function equal(actual, expected, reason) {
if (actual != expected) {
if (reason == null) { reason = `${ actual } == ${ expected }`; }
if (actual == expected) { return; }

throwError(reason, { actual, expected, operator: "==" });
}
if (reason == null) { reason = `${ actual } == ${ expected }`; }
throwError(reason, { actual, expected, operator: "==" });
}

function isDeepEqual(actual, expected, memo) {
if (actual === expected) {
return true;
}
if (actual === expected) { return true; }

// One or both things aren't objects
if (actual === null || typeof(expected) !== 'object') {
Expand Down Expand Up @@ -70,7 +67,7 @@ export function throws(func, checkFunc, reason) {
func();

} catch (e) {
if (checkFunc(e)) { return true; }
if (checkFunc(e)) { return; }

throwError(`The expected exception validation function returned false`, {
actual: e,
Expand All @@ -86,7 +83,11 @@ export function throws(func, checkFunc, reason) {

export async function rejects(func, checkFunc, reason) {
try {
await func();
if (func.then) {
await func;
} else {
await func();
}
} catch (e) {
if (checkFunc(e)) { return true; }

Expand All @@ -98,7 +99,7 @@ export async function rejects(func, checkFunc, reason) {
}

throwError("Missing rejection", {
operator: "rejects"
operation: "rejects"
});
}

Expand Down

0 comments on commit c845357

Please sign in to comment.