forked from hexojs/hexo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request hexojs#1391 from leesei/master
[helper] add log()
- Loading branch information
Showing
4 changed files
with
41 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
'use strict'; | ||
|
||
var should = require('chai').should(); | ||
|
||
describe('debug', function(){ | ||
var debug = require('../../../lib/plugins/helper/debug'); | ||
var inspect = require('util').inspect; | ||
|
||
it('inspect simple object', function(){ | ||
var obj = { foo: "bar" }; | ||
debug.inspectObject(obj).should.eql(inspect(obj)); | ||
}); | ||
|
||
it('inspect circular object', function(){ | ||
var obj = { foo: "bar" }; | ||
obj.circular = obj; | ||
debug.inspectObject(obj).should.eql(inspect(obj)); | ||
}); | ||
|
||
it('inspect deep object', function(){ | ||
var obj = { baz: { thud: "narf", dur: { foo: "bar", baz: { bang: "zoom" } } } }; | ||
debug.inspectObject(obj).should.not.eql(inspect(obj, {depth: 5})); | ||
debug.inspectObject(obj, {depth: 5}).should.eql(inspect(obj, {depth: 5})); | ||
}); | ||
|
||
it('log should print to console', function(){ | ||
debug.log('Hello %s from debug.log()!', 'World'); | ||
// console should print 'Hello World from debug.log()!' | ||
debug.should.be.a('object'); // void assert | ||
}); | ||
}); |
This file contains 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 characters