aboutsummaryrefslogtreecommitdiff
path: root/node_modules/nomnom/test/callback.js
blob: 3d512dbed8bcf18947e3c3ce366fa121b33d1d6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
var nomnom = require("../nomnom");

exports.testVersion = function(test) {
   test.expect(1);
   
   nomnom().options({
      date: {
         callback: function(date) {
            test.equal(date, "2010-02-03", "date should match value")
         }
      }
   }).parse(["--date=2010-02-03"]);

   test.done();
}

exports.testReturnString = function(test) {
   test.expect(1);

   nomnom().options({
      version: {
         flag: true,
         callback: function() {
            return "v0.3";
         }
      }
   })
   .printer(function(string) { 
      test.equal(0, string.indexOf("v0.3"))
      test.done();
   })
   .parse(["--version"]);
}