Never again will changes to 'sample.js' bite us in the ass

This commit is contained in:
Corey Johnson
2012-06-29 10:20:43 -07:00
parent c3d7d3566f
commit 2ff1cc9baf

View File

@@ -150,3 +150,19 @@ $.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));
};
"""