Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

export the tap output objects for testing

  • Loading branch information...
commit eb1edaeaceb3669f2b8f8fbd8d07e0a0e83c39d2 1 parent 7294f85
@isaacs authored
Showing with 31 additions and 35 deletions.
  1. +31 −35 test/common.js
View
66 test/common.js
@@ -1,36 +1,32 @@
-// Usage:
-// console.log(tap([{ok:true, prefix: "Testing the foo module", name:"the module exists"}
-// ,{ok:false, name:"7 == 8"}
-// ,{ok:true, "'foo' === 'foo'"}]))
+exports.taps = ["Tests for the foo module"
+ ,{ok:true, name:"test that the foo is fooish"
+ ,file:"foo.js", line:8, name:"fooish test"
+ ,stack:new Error("fooish").stack}
+ ,{ok:false, name:"a test that the bar is barish"
+ ,file:"bar.js", line:25
+ ,expected:"bar\nbar\nbaz", actual:"rab\nrib\nzib"
+ ,hash:{more:"\nstuff\nhere\n",regexp:/asdf/}}
+ ,"Quux module tests"
+ ,"This is a longer comment"
+ ,{ok:true, name:"an easy one."}
+ ,{ok:false, name:"bloooooo"
+ ,expected:"blerggeyyy"
+ ,actual:"blorggeyy"}
+ ,{ok:false, name:"array test"
+ ,expected:[{ok:true},{ok:true},{stack:new Error().stack}]
+ ,actual:[1234567890,123456789,{error:new Error("yikes")}]}
+ ,{ok:true, name:"nulltest"
+ ,expected:undefined, actual:null}
+ ,{ok:true, name:"weird key test"
+ ,expected:"weird key"
+ ,actual:"weird key"
+ ,"this object":{"has a ":"weird key"
+ ,"and a looooooooonnnnnnnnnggg":"jacket"}}
+ ,{ok:true, name:"regexp test"
+ ,regexp:/asdf/,function:function (a,b) { return a + b }}
+ ]
-
-
-var taps = ["Tests for the foo module"
- ,{ok:true, name:"test that the foo is fooish"
- ,file:"foo.js", line:8, name:"fooish test"
- ,stack:new Error("fooish").stack}
- ,{ok:false, name:"a test that the bar is barish"
- ,file:"bar.js", line:25
- ,expected:"bar\nbar\nbaz", actual:"rab\nrib\nzib"
- ,hash:{more:"\nstuff\nhere\n",regexp:/asdf/}}
- ,"Quux module tests"
- ,"This is a longer comment"
- ,{ok:true, name:"an easy one."}
- ,{ok:false, name:"bloooooo"
- ,expected:"blerggeyyy"
- ,actual:"blorggeyy"}
- ,{ok:false, name:"array test"
- ,expected:[{ok:true},{ok:true},{stack:new Error().stack}]
- ,actual:[1234567890,123456789,{error:new Error("yikes")}]}
- ,{ok:true, name:"nulltest"
- ,expected:undefined, actual:null}
- ,{ok:true, name:"weird key test"
- ,expected:"weird key"
- ,actual:"weird key"
- ,"this object":{"has a ":"weird key"
- ,"and a looooooooonnnnnnnnnggg":"jacket"}}
- ,{ok:true, name:"regexp test"
- ,regexp:/asdf/,function:function (a,b) { return a + b }}
- ]
-
-throw "fail, yo!"
+if (require.main === module) {
+ console.log("1..1")
+ console.log("ok 1 - just setup, nothing relevant")
+}
Please sign in to comment.
Something went wrong with that request. Please try again.