Use fs.md5ForPath in spec-helpert o ensure sample.js isn't modified

This commit is contained in:
Nathan Sobo
2012-07-02 19:21:24 -06:00
parent 6ebe75c0bd
commit 06cdcaa820

View File

@@ -154,18 +154,5 @@ $.fn.textInput = (data) ->
$.fn.simulateDomAttachment = ->
$('<html>').append(this)
throw "Sample.js is modified" unless fs.read(require.resolve('fixtures/sample.js')) == """
var quicksort = function () {
var sort = function(items) {
if (items.length <= 1) return items;
var pivot = items.shift(), current, left = [], right = [];
while(items.length > 0) {
current = items.shift();
current < pivot ? left.push(current) : right.push(current);
}
return sort(left).concat(pivot).concat(sort(right));
};
return sort(Array.apply(this, arguments));
};
"""
unless fs.md5ForPath(require.resolve('fixtures/sample.js')) == "dd38087d0d7e3e4802a6d3f9b9745f2b"
throw "Sample.js is modified"