Last active
December 17, 2015 12:19
-
-
Save daogurtsov/5609292 to your computer and use it in GitHub Desktop.
Revisions
-
daogurtsov revised this gist
Aug 11, 2013 . 1 changed file with 2 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 @@ -9,6 +9,7 @@ results.id = "results"; var html = results.outerHTML; document.write(html); results = document.getElementById("results"); this.assert = function assert(value, desc) { var li = document.createElement("li"); li.className = value ? "pass" : "fail"; @@ -18,9 +19,6 @@ li.style.color = "red"; } li.appendChild(document.createTextNode(desc)); results.appendChild(li); if (!value) { li.parentNode.parentNode.className = "fail"; @@ -36,6 +34,7 @@ }; })(); window.onload = function() { test("A test.", function() { assert(true, "First assertion completed"); -
daogurtsov revised this gist
Aug 11, 2013 . 1 changed file with 5 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 @@ -18,9 +18,13 @@ li.style.color = "red"; } li.appendChild(document.createTextNode(desc)); if(!results){ results = document.getElementById("results"); } results.appendChild(li); if (!value) { li.parentNode.parentNode.className = "fail"; li.parentNode.parentNode.style.color = "red"; } return li; }; @@ -31,6 +35,7 @@ fn(); }; })(); window.onload = function() { test("A test.", function() { assert(true, "First assertion completed"); -
daogurtsov revised this gist
Aug 11, 2013 . 1 changed file with 28 additions and 25 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,29 +1,35 @@ <html> <head> <title>Test Suite</title> </head> <body> <script> (function () { var results = document.createElement("ul"); results.id = "results"; var html = results.outerHTML; document.write(html); this.assert = function assert(value, desc) { var li = document.createElement("li"); li.className = value ? "pass" : "fail"; if(li.className === "pass"){ li.style.color = "green"; }else{ li.style.color = "red"; } li.appendChild(document.createTextNode(desc)); results.appendChild(li); if (!value) { li.parentNode.parentNode.className = "fail"; } return li; }; this.test = function test(name, fn) { results = document.getElementById("results"); results = assert(true, name).appendChild( document.createElement("ul")); fn(); }; })(); window.onload = function() { test("A test.", function() { @@ -42,8 +48,5 @@ }); }; </script> </body> </html> -
daogurtsov revised this gist
Jul 13, 2013 . 1 changed file with 0 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 @@ -34,8 +34,6 @@ test("Another test.", function() { assert(true, "First test completed"); assert(false, "Second test failed"); assert(true, "Third assertion completed"); }); test("A third test.", function() { -
daogurtsov renamed this gist
Jul 13, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
daogurtsov renamed this gist
Jul 13, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
daogurtsov renamed this gist
Jul 13, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
daogurtsov renamed this gist
Jul 13, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
daogurtsov revised this gist
Jul 1, 2013 . 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 @@ -1,6 +1,10 @@ <html> <head> <title>Test Suite</title> <style> #results li.pass { color: green; } #results li.fail { color: red; } </style> <script> (function() { var results; @@ -40,10 +44,6 @@ window.onload = function() { }); }; </script> </head> <body> <ul id="results"></ul> -
daogurtsov created this gist
May 19, 2013 .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,51 @@ <html> <head> <title>Test Suite</title> <script> (function() { var results; this.assert = function assert(value, desc) { var li = document.createElement("li"); li.className = value ? "pass" : "fail"; li.appendChild(document.createTextNode(desc)); results.appendChild(li); if (!value) { li.parentNode.parentNode.className = "fail"; } return li; }; this.test = function test(name, fn) { results = document.getElementById("results"); results = assert(true, name).appendChild( document.createElement("ul")); fn(); }; })(); window.onload = function() { test("A test.", function() { assert(true, "First assertion completed"); assert(true, "Second assertion completed"); assert(true, "Third assertion completed"); }); test("Another test.", function() { assert(true, "First test completed"); assert(false, "Second test failed"); Listing2.5 An implementation of test grouping 25 The fundamentals of a test suite assert(true, "Third assertion completed"); }); test("A third test.", function() { assert(null, "fail"); assert(5, "pass") }); }; </script> <style> #results li.pass { color: green; } #results li.fail { color: red; } </style> </head> <body> <ul id="results"></ul> </body> </html>