-
-
Save unders/ee6a50eabce3dbea57ee4cb0c59e033a to your computer and use it in GitHub Desktop.
Revisions
-
freedmand revised this gist
Nov 3, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -24,7 +24,7 @@ class Tester { } assert(condition) { if (!condition) throw new Error(`Expected ${condition} to be truthy`); } } -
freedmand revised this gist
Nov 3, 2018 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,7 +30,6 @@ class Tester { /* Usage: const t = new Tester(); -
freedmand revised this gist
Nov 3, 2018 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -28,7 +28,9 @@ class Tester { } } /* Usage: const t = new Tester(); -
freedmand revised this gist
Nov 3, 2018 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ const PASS = ['32']; // green const FAIL = ['31', '1']; // red, bold function logStyle(ansiEscapeCodes, text) { console.log(`\x1b[${ansiEscapeCodes.join(';')}m${text}\x1b[0m`); -
freedmand revised this gist
Nov 3, 2018 . No changes.There are no files selected for viewing
-
freedmand revised this gist
Nov 3, 2018 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -32,9 +32,11 @@ class Tester { Usage: const t = new Tester(); t.test('testName', () => { t.assertEquals('dog'.length, 3); // will pass }); t.test('anotherTestName', () => { t.assert(false); // will fail }); -
freedmand revised this gist
Nov 3, 2018 . 1 changed file with 5 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -29,12 +29,14 @@ class Tester { } /* Usage: const t = new Tester(); t.test('testName', () => { t.assertEquals('dog'.length, 3); // will pass }); t.test('anotherTestName', () => { t.assert(false); // will fail }); */ -
freedmand revised this gist
Nov 3, 2018 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -19,13 +19,13 @@ class Tester { } } assertEquals(arg1, arg2) { if (arg1 != arg2) throw new Error(`Expected ${arg1} to equal ${arg2}`); } assert(condition) { this.assertEquals(condition, true); } } /* -
freedmand created this gist
Nov 3, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,40 @@ const PASS = ['32']; // green const FAIL = ['31', '1']; // red, bold function logStyle(ansiEscapeCodes, text) { console.log(`\x1b[${ansiEscapeCodes.join(';')}m${text}\x1b[0m`); } class Tester { constructor() {} test(name, fn) { try { fn.bind(this)(); logStyle(PASS, `${name} PASSED`); } catch (e) { logStyle(FAIL, `${name} FAILED: ${e}`); } } assert(condition) { if (!condition) throw new Error(`Expected ${condition} to be true`); } assertEquals(arg1, arg2) { if (arg1 != arg2) throw new Error(`Expected ${arg1} to equal ${arg2}`); } } /* Usage (try it in a web inspector console): const t = new Tester(); t.test('testName', () => { t.assertEquals('dog'.length, 3); t.assert(false); // will fail }); */