Skip to content

Commit

Permalink
Move test scripts to scripts folder
Browse files Browse the repository at this point in the history
  • Loading branch information
tommy351 committed Apr 26, 2014
1 parent a5be253 commit 91f6b8d
Show file tree
Hide file tree
Showing 30 changed files with 41 additions and 35 deletions.
9 changes: 7 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ var gulp = require('gulp'),
path = require('path');

var lib = 'lib/**/*.js',
test = 'test/**/*.test.js';
test = 'test/scripts/**/*.js';

var handleError = function(err){
console.error(err.stack);
this.emit('end');
}

gulp.task('hexo', function(callback){
require('./lib/init')(path.join(__dirname, 'test', 'blog'), {
Expand All @@ -19,7 +24,7 @@ gulp.task('mocha', ['hexo'], function(){
.pipe(mocha({
reporter: 'dot',
ignoreLeaks: true
}));
}).on('error', handleError));
});

gulp.task('jshint', function(){
Expand Down
9 changes: 5 additions & 4 deletions test/core.test.js → test/scripts/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ var path = require('path'),
should = require('chai').should();

describe('Core', function(){
var baseDir = path.join(__dirname, 'blog') + path.sep,
coreDir = path.dirname(__dirname) + path.sep;
var testDir = path.dirname(__dirname),
baseDir = path.join(testDir, 'blog') + path.sep,
coreDir = path.dirname(testDir) + path.sep;

it('core_dir', function(){
hexo.core_dir.should.eql(coreDir);
Expand All @@ -14,7 +15,7 @@ describe('Core', function(){
});

it('version', function(){
hexo.version.should.eql(require('../package.json').version);
hexo.version.should.eql(require('../../package.json').version);
});

it('base_dir', function(){
Expand Down Expand Up @@ -46,7 +47,7 @@ describe('Core', function(){
hexo.env.safe.should.be.false;
hexo.env.silent.should.be.true;
hexo.env.env.should.eql('development');
hexo.env.version.should.eql(require('../package.json').version);
hexo.env.version.should.eql(require('../../package.json').version);
hexo.env.init.should.be.true;
});
});
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var should = require('chai').should();

describe('Filter - auto_spacing', function(){
var auto_spacing = require('../../lib/plugins/filter/auto_spacing');
var auto_spacing = require('../../../lib/plugins/filter/auto_spacing');

before(function(){
hexo.config.auto_spacing = true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var should = require('chai').should();

describe('Filter - excerpt', function(){
var excerpt = require('../../lib/plugins/filter/excerpt');
var excerpt = require('../../../lib/plugins/filter/excerpt');

it('with tag', function(){
excerpt({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var should = require('chai').should();

describe('Filter - external_link', function(){
var external_link = require('../../lib/plugins/filter/external_link');
var external_link = require('../../../lib/plugins/filter/external_link');

it('internal link', function(){
external_link({
Expand Down
2 changes: 1 addition & 1 deletion test/helper/css.test.js → test/scripts/helper/css.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var should = require('chai').should();

describe('Helper - css', function(){
var css = require('../../lib/plugins/helper/css');
var css = require('../../../lib/plugins/helper/css');

var genResult = function(arr){
var result = [];
Expand Down
2 changes: 1 addition & 1 deletion test/helper/date.test.js → test/scripts/helper/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var moment = require('moment'),
should = require('chai').should();

describe('Helper - date', function(){
var date = require('../../lib/plugins/helper/date'),
var date = require('../../../lib/plugins/helper/date'),
config = hexo.config;

var genTimeTag = function(date, format){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var crypto = require('crypto'),
should = require('chai').should();

describe('Helper - gravatar', function(){
var gravatar = require('../../lib/plugins/helper/gravatar');
var gravatar = require('../../../lib/plugins/helper/gravatar');

var md5 = function(str){
return crypto.createHash('md5').update(str).digest('hex');
Expand Down
2 changes: 1 addition & 1 deletion test/helper/is.test.js → test/scripts/helper/is.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var should = require('chai').should();

describe('Helper - is', function(){
var is = require('../../lib/plugins/helper/is'),
var is = require('../../../lib/plugins/helper/is'),
config = hexo.config;

it('is_current', function(){
Expand Down
2 changes: 1 addition & 1 deletion test/helper/js.test.js → test/scripts/helper/js.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var should = require('chai').should();

describe('Helper - js', function(){
var js = require('../../lib/plugins/helper/js');
var js = require('../../../lib/plugins/helper/js');

var genResult = function(arr){
var result = [];
Expand Down
2 changes: 1 addition & 1 deletion test/helper/link.test.js → test/scripts/helper/link.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var should = require('chai').should();

describe('Helper - link', function(){
var link = require('../../lib/plugins/helper/link');
var link = require('../../../lib/plugins/helper/link');

describe('link_to', function(){
var link_to = link.link_to,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var should = require('chai').should();

describe('Helper - number', function(){
var number = require('../../lib/plugins/helper/number');
var number = require('../../../lib/plugins/helper/number');

describe('number_format', function(){
it('default', function(){
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion test/i18n/i18n.test.js → test/scripts/i18n/i18n.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var should = require('chai').should();

describe('i18n', function(){
var I18n = require('../../lib/core/i18n'),
var I18n = require('../../../lib/core/i18n'),
i18n = new I18n({code: 'zh-TW'});

['default', 'zh-TW'].forEach(function(name){
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var cheerio = require('cheerio'),
should = require('chai').should();

describe('Tag - blockquote', function(){
var blockquote = require('../../lib/plugins/tag/blockquote');
var blockquote = require('../../../lib/plugins/tag/blockquote');

var raw = '123456 **bold** and *italic*';

Expand Down
4 changes: 2 additions & 2 deletions test/tag/code.test.js → test/scripts/tag/code.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
var cheerio = require('cheerio'),
should = require('chai').should(),
highlight = require('../../lib/util/highlight');
highlight = require('../../../lib/util/highlight');

describe('Tag - code', function(){
var code = require('../../lib/plugins/tag/code');
var code = require('../../../lib/plugins/tag/code');

var dummy = [
'var dummy = function(){',
Expand Down
2 changes: 1 addition & 1 deletion test/tag/gist.test.js → test/scripts/tag/gist.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var cheerio = require('cheerio'),
should = require('chai').should();

describe('Tag - gist', function(){
var gist = require('../../lib/plugins/tag/gist');
var gist = require('../../../lib/plugins/tag/gist');

it('id', function(){
var $ = cheerio.load(gist(['foo']));
Expand Down
2 changes: 1 addition & 1 deletion test/tag/iframe.test.js → test/scripts/tag/iframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var cheerio = require('cheerio'),
should = require('chai').should();

describe('Tag - iframe', function(){
var iframe = require('../../lib/plugins/tag/iframe');
var iframe = require('../../../lib/plugins/tag/iframe');

it('url', function(){
var $ = cheerio.load(iframe(['http://zespia.tw']));
Expand Down
2 changes: 1 addition & 1 deletion test/tag/img.test.js → test/scripts/tag/img.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var cheerio = require('cheerio'),
should = require('chai').should();

describe('Tag - img', function(){
var img = require('../../lib/plugins/tag/img');
var img = require('../../../lib/plugins/tag/img');

it('src', function(){
var $ = cheerio.load(img(['http://placekitten.com/200/300']));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
var cheerio = require('cheerio'),
path = require('path'),
should = require('chai').should(),
file = require('../../lib/util/file2'),
highlight = require('../../lib/util/highlight');
file = require('../../../lib/util/file2'),
highlight = require('../../../lib/util/highlight');

describe('include_code', function(){
var include_code = require('../../lib/plugins/tag/include_code'),
var include_code = require('../../../lib/plugins/tag/include_code'),
content = '';

before(function(done){
Expand Down
2 changes: 1 addition & 1 deletion test/tag/jsfiddle.test.js → test/scripts/tag/jsfiddle.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var cheerio = require('cheerio'),
should = require('chai').should();

describe('Tag - jsfiddle', function(){
var jsfiddle = require('../../lib/plugins/tag/jsfiddle');
var jsfiddle = require('../../../lib/plugins/tag/jsfiddle');

it('id', function(){
var $ = cheerio.load(jsfiddle(['foo']));
Expand Down
2 changes: 1 addition & 1 deletion test/tag/link.test.js → test/scripts/tag/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var cheerio = require('cheerio'),
should = require('chai').should();

describe('Tag - link', function(){
var link = require('../../lib/plugins/tag/link');
var link = require('../../../lib/plugins/tag/link');

it('text + url', function(){
var $ = cheerio.load(link('Click here to Google http://google.com'.split(' ')));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var cheerio = require('cheerio'),
should = require('chai').should();

describe('pullquote', function(){
var pullquote = require('../../lib/plugins/tag/pullquote');
var pullquote = require('../../../lib/plugins/tag/pullquote');

var raw = '123456 **bold** and *italic*';

Expand Down
2 changes: 1 addition & 1 deletion test/tag/raw.test.js → test/scripts/tag/raw.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var should = require('chai').should();

describe('Tag - raw', function(){
var raw = require('../../lib/plugins/tag/raw');
var raw = require('../../../lib/plugins/tag/raw');

it('content', function(){
raw([], '123456789<b>strong</b>987654321').should.eql('123456789<b>strong</b>987654321');
Expand Down
2 changes: 1 addition & 1 deletion test/tag/vimeo.test.js → test/scripts/tag/vimeo.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var cheerio = require('cheerio'),
should = require('chai').should();

describe('Tag - vimeo', function(){
var vimeo = require('../../lib/plugins/tag/vimeo');
var vimeo = require('../../../lib/plugins/tag/vimeo');

it('id', function(){
var $ = cheerio.load(vimeo(['foo']));
Expand Down
2 changes: 1 addition & 1 deletion test/tag/youtube.test.js → test/scripts/tag/youtube.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var cheerio = require('cheerio'),
should = require('chai').should();

describe('Tag - youtube', function(){
var youtube = require('../../lib/plugins/tag/youtube');
var youtube = require('../../../lib/plugins/tag/youtube');

it('id', function(){
var $ = cheerio.load(youtube(['foo']));
Expand Down
2 changes: 1 addition & 1 deletion test/util/file2.test.js → test/scripts/util/file2.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var path = require('path'),
async = require('async');

describe('Util - file2', function(){
var file = require('../../lib/util/file2');
var file = require('../../../lib/util/file2');

var uid = function(length){
var txt = '0123456789abcdefghijklmnopqrstuvwxyz',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
describe('Util - html_tag', function(){
var html_tag = require('../../lib/util/html_tag');
var html_tag = require('../../../lib/util/html_tag');

it('tag', function(){
html_tag('hr').should.eql('<hr>');
Expand Down
2 changes: 1 addition & 1 deletion test/util/yfm.test.js → test/scripts/util/yfm.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var yaml = require('yamljs'),
should = require('chai').should();

describe('Util - yfm', function(){
var yfm = require('../../lib/util/yfm');
var yfm = require('../../../lib/util/yfm');

describe('parse', function(){
it('only content', function(){
Expand Down

0 comments on commit 91f6b8d

Please sign in to comment.