Permalink
Browse files

I hate tests

  • Loading branch information...
1 parent 4d2578b commit e98d5ccbc6abf8f42a87aa6266819c1000905447 @dsimard committed Apr 12, 2010
Showing with 52 additions and 1 deletion.
  1. +14 −0 index.html
  2. +38 −1 test/nofreeze.html
View
@@ -13,6 +13,20 @@
$("#resp").click(function() {
var i = 0;
+ jsk.nofreeze.for(
+ function() { i < 100; console.log("if", i); },
+ function() { console.log("inv", i); i++; console.log("after", i);},
+ function fct() {
+ console.log("after", i);
+ },
+ null,
+ function() {
+ console.log("obj", i);
+ }
+ );
+ return;
+
+ var i = 0;
var f = jsk.nofreeze.for(
function() {return i < 10},
function() {i++;},
View
@@ -2,7 +2,7 @@
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
- <script src="http://code.jquery.com/jquery-latest.js"></script>
+ <script src="../jquery-1.3.2.js"></script>
<link rel="stylesheet" href="qunit.css" type="text/css" media="screen" />
<script type="text/javascript" src="qunit.js"></script>
<script type="text/javascript" src="../src/jskata.nofreeze.js"></script>
@@ -13,6 +13,43 @@
ok(_.nf !== undefined);
ok(javascriptKataDotCom.nofreeze !== undefined);
});
+
+ test("array", function() {
+ var array = [1,2,3];
+ var array2 = [];
+ var check = function check() {
+ for(i in array) {
+ equal(array[i], array[i]);
+ };
+ };
+
+ _.nf.each(array, function(i, val) {
+ array2.push(val);
+ }, null, check);
+ });
+
+ test("for", function() {
+ var count = 0;
+ var i = 0;
+
+ var check = function check() {
+ equal(count, 100);
+ }
+
+ _.nf.for(
+ function() { return i < 100; },
+ function() { i++; },
+ function fct() {
+ count++;
+ },
+ {},
+ function() {
+ console.log("onstop", count);
+ check();
+ equal(count, 2);
+ }
+ );
+ });
});
</script>
</head>

0 comments on commit e98d5cc

Please sign in to comment.