Skip to content

Commit 561df24

Browse files
committed
fix failing tests on windows
1 parent 63140e0 commit 561df24

File tree

4 files changed

+57
-57
lines changed

4 files changed

+57
-57
lines changed

lib/html.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ helpers.css = function(list, options) {
6161

6262
return styles.map(function(item) {
6363
var ext = path.extname(item);
64-
var fp = path.join(assets, item);
64+
var fp = path.posix.join(assets, item);
6565

6666
if (ext === '.less') {
6767
return '<link type="text/css" rel="stylesheet/less" href="' + fp + '">';

test/fs.js

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -45,79 +45,79 @@ describe('fs', function() {
4545
}
4646

4747
assert.deepEqual(fn({dir: 'lib', filter: filter}).split(','), [
48-
'lib/array.js',
49-
'lib/code.js',
50-
'lib/collection.js',
51-
'lib/comparison.js',
52-
'lib/date.js',
53-
'lib/fs.js',
54-
'lib/html.js',
55-
'lib/i18n.js',
56-
'lib/index.js',
57-
'lib/inflection.js',
58-
'lib/logging.js',
59-
'lib/markdown.js',
60-
'lib/match.js',
61-
'lib/math.js',
62-
'lib/misc.js',
63-
'lib/number.js',
64-
'lib/object.js',
65-
'lib/path.js',
66-
'lib/regex.js',
67-
'lib/string.js',
68-
'lib/url.js'
48+
path.join('lib', 'array.js'),
49+
path.join('lib', 'code.js'),
50+
path.join('lib', 'collection.js'),
51+
path.join('lib', 'comparison.js'),
52+
path.join('lib', 'date.js'),
53+
path.join('lib', 'fs.js'),
54+
path.join('lib', 'html.js'),
55+
path.join('lib', 'i18n.js'),
56+
path.join('lib', 'index.js'),
57+
path.join('lib', 'inflection.js'),
58+
path.join('lib', 'logging.js'),
59+
path.join('lib', 'markdown.js'),
60+
path.join('lib', 'match.js'),
61+
path.join('lib', 'math.js'),
62+
path.join('lib', 'misc.js'),
63+
path.join('lib', 'number.js'),
64+
path.join('lib', 'object.js'),
65+
path.join('lib', 'path.js'),
66+
path.join('lib', 'regex.js'),
67+
path.join('lib', 'string.js'),
68+
path.join('lib', 'url.js')
6969
]);
7070
});
7171

7272
it('should filter using a regex', function() {
7373
var fn = hbs.compile('{{readdir dir (toRegex "\\.js$")}}');
7474
assert.deepEqual(fn({dir: 'lib'}).split(','), [
75-
'lib/array.js',
76-
'lib/code.js',
77-
'lib/collection.js',
78-
'lib/comparison.js',
79-
'lib/date.js',
80-
'lib/fs.js',
81-
'lib/html.js',
82-
'lib/i18n.js',
83-
'lib/index.js',
84-
'lib/inflection.js',
85-
'lib/logging.js',
86-
'lib/markdown.js',
87-
'lib/match.js',
88-
'lib/math.js',
89-
'lib/misc.js',
90-
'lib/number.js',
91-
'lib/object.js',
92-
'lib/path.js',
93-
'lib/regex.js',
94-
'lib/string.js',
95-
'lib/url.js'
75+
path.join('lib', 'array.js'),
76+
path.join('lib', 'code.js'),
77+
path.join('lib', 'collection.js'),
78+
path.join('lib', 'comparison.js'),
79+
path.join('lib', 'date.js'),
80+
path.join('lib', 'fs.js'),
81+
path.join('lib', 'html.js'),
82+
path.join('lib', 'i18n.js'),
83+
path.join('lib', 'index.js'),
84+
path.join('lib', 'inflection.js'),
85+
path.join('lib', 'logging.js'),
86+
path.join('lib', 'markdown.js'),
87+
path.join('lib', 'match.js'),
88+
path.join('lib', 'math.js'),
89+
path.join('lib', 'misc.js'),
90+
path.join('lib', 'number.js'),
91+
path.join('lib', 'object.js'),
92+
path.join('lib', 'path.js'),
93+
path.join('lib', 'regex.js'),
94+
path.join('lib', 'string.js'),
95+
path.join('lib', 'url.js')
9696
]);
9797
});
9898

9999
it('should filter using a glob pattern', function() {
100100
var fn = hbs.compile('{{readdir dir "lib/[a-d]*.js"}}');
101101
assert.deepEqual(fn({dir: 'lib'}).split(','), [
102-
'lib/array.js',
103-
'lib/code.js',
104-
'lib/collection.js',
105-
'lib/comparison.js',
106-
'lib/date.js'
102+
path.join('lib', 'array.js'),
103+
path.join('lib', 'code.js'),
104+
path.join('lib', 'collection.js'),
105+
path.join('lib', 'comparison.js'),
106+
path.join('lib', 'date.js')
107107
]);
108108
});
109109

110110
it('should filter by fs.stat (files)', function() {
111111
var fn = hbs.compile('{{readdir dir "isFile"}}');
112112
assert.deepEqual(fn({dir: 'lib'}).split(','), libFiles.filter(function(fp) {
113-
return fp.indexOf('lib/util') !== 0;
113+
return fp.indexOf(path.join('lib', 'util')) !== 0;
114114
}));
115115
});
116116

117117
it('should filter by fs.stat (dirs)', function() {
118118
var fn = hbs.compile('{{readdir dir "isDirectory"}}');
119119
assert.deepEqual(fn({dir: 'lib'}).split(','), [
120-
'lib/utils'
120+
path.join('lib', 'utils')
121121
]);
122122
});
123123

test/integration/templates.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ describe('templates integration tests', function() {
5454
describe('relative', function() {
5555
it('should return the relative path from file A to file B', function() {
5656
var view = compile('{{relative "dist/docs.html" "index.html"}}');
57-
assert.equal(view.fn(), '../index.html');
57+
assert.equal(view.fn(), path.join('..', 'index.html'));
5858
});
59-
it('should return the relative path from file A to file B', function() {
59+
it('should return the relative path from file A to file B in', function() {
6060
var view = compile('{{relative "examples/result/md/path.md" "examples/assets"}}');
61-
assert.equal(view.fn(), '../../assets');
61+
assert.equal(view.fn(), path.join('..', '..', 'assets'));
6262
});
6363
it('should use the cwd passed on options', function() {
6464
var view = compile('{{relative "examples/result/md/path.md" "examples/assets"}}');
65-
assert.equal(view.fn({cwd: gm}), '../../assets');
65+
assert.equal(view.fn({cwd: gm}), path.join('..', '..', 'assets'));
6666
});
6767
});
6868

test/path.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ describe('assemble', function() {
3232
describe('relative', function() {
3333
it('should return the relative path from file A to file B', function() {
3434
var fn = hbs.compile('{{relative "dist/docs.html" "index.html"}}');
35-
assert.equal(fn(), '../index.html');
35+
assert.equal(fn(), path.join('..', 'index.html'));
3636
});
3737
it('should return the relative path from file A to file B', function() {
3838
var fn = hbs.compile('{{relative "examples/result/md/path.md" "examples/assets"}}');
39-
assert.equal(fn(), '../../assets');
39+
assert.equal(fn(), path.join('..', '..', 'assets'));
4040
});
4141
it('should use the cwd passed on options', function() {
4242
var fn = hbs.compile('{{relative "examples/result/md/path.md" "examples/assets"}}');
43-
assert.equal(fn({cwd: gm}), '../../assets');
43+
assert.equal(fn({cwd: gm}), path.join('..', '..', 'assets'));
4444
});
4545
});
4646

0 commit comments

Comments
 (0)