Permalink
Browse files

stuff

  • Loading branch information...
1 parent 53c6217 commit d87f4d369c0fb0f509e2885f20c7c43ce7a0e6e8 Nick Miller committed Jul 30, 2013
Showing with 26 additions and 0 deletions.
  1. +26 −0 jsl/resources/tests.js
View
@@ -137,3 +137,29 @@ test("Functions close over variables in scope at the time they were created, not
});
+test("Array literals", function () {
+ var myArray = ["Dog","Cat","Fish"];
+
+ ok(myArray[1] == "Cat");
+ ok(myArray.length == 3);
+});
+
+
+test("Empty elements in array literals are undefined", function() {
+ var myArray = ["Dog", , "Cat"];
+ ok(myArray[1] == undefined)
+}) ;
+
+test("Trailing commas in array literals are ignored", function() {
+ var myArray = ['Dog','Cat',];
+ ok(myArray.length == 2);
+}) ;
+
+test("Use the Boolean object to convert null, NaN and undefined to false", function () {
+ var myNaN = NaN;
+ var myUndefined = undefined;
+ var myNull = null;
+ var boolWrapper = new Boolean(myNaN && myUndefined && myNull);
+ ok(boolWrapper == false && myNaN != false);
+
+});

0 comments on commit d87f4d3

Please sign in to comment.