From e2c5e92cd391ef916287c79e48480108af4c7d0c Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 24 Oct 2013 09:09:18 -0700 Subject: [PATCH] Fix failing tests for `rhino -require`. --- test/test.js | 16 ++++++++-------- vendor/qunit-clib/qunit-clib.js | 21 +++++++++------------ 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/test/test.js b/test/test.js index 9b156974a..d6fba5abb 100644 --- a/test/test.js +++ b/test/test.js @@ -524,13 +524,13 @@ var bound = _.bind(func, null), actual = bound('a'); - ok(actual[0] === null || actual[0] === root); + ok(actual[0] === null || actual[0] && actual[0].Array); equal(actual[1], 'a'); bound = _.bind(func, undefined); actual = bound('b'); - ok(actual[0] === undefined || actual[0] === root); + ok(actual[0] === undefined || actual[0] && actual[0].Array); equal(actual[1], 'b'); }); @@ -6008,33 +6008,33 @@ test('should work with custom `_.templateSettings` delimiters', 1, function() { var settings = _.clone(_.templateSettings); - _.templateSettings = { + _.assign(_.templateSettings, { 'escape': /\{\{-([\s\S]+?)\}\}/g, 'evaluate': /\{\{([\s\S]+?)\}\}/g, 'interpolate': /\{\{=([\s\S]+?)\}\}/g - }; + }); var compiled = _.template(''), expected = ''; equal(compiled({ 'collection': ['a & A', 'b & B'] }), expected); - _.extend(_.templateSettings, settings); + _.assign(_.templateSettings, settings); }); test('should work with `_.templateSettings` delimiters containing special characters', 1, function() { var settings = _.clone(_.templateSettings); - _.templateSettings = { + _.assign(_.templateSettings, { 'escape': /<\?-([\s\S]+?)\?>/g, 'evaluate': /<\?([\s\S]+?)\?>/g, 'interpolate': /<\?=([\s\S]+?)\?>/g - }; + }); var compiled = _.template(''), expected = ''; equal(compiled({ 'collection': ['a & A', 'b & B'] }), expected); - _.extend(_.templateSettings, settings); + _.assign(_.templateSettings, settings); }); test('supports recursive calls', 1, function() { diff --git a/vendor/qunit-clib/qunit-clib.js b/vendor/qunit-clib/qunit-clib.js index 296ac4abe..61439a671 100644 --- a/vendor/qunit-clib/qunit-clib.js +++ b/vendor/qunit-clib/qunit-clib.js @@ -173,26 +173,23 @@ console.log(' Finished in ' + details.runtime + ' milliseconds.'); console.log(hr); - var fails = details.failed, - error = fails + ' of ' + details.total + ' tests failed.'; - // exit out of Node.js or PhantomJS try { var process = context.process || context.phantom; - if (fails) { - console.error('Error: ' + error); + if (details.failed) { process.exit(1); } else { process.exit(0); } - } catch(e) { - if (fails) { - throw new Error(error); - } - } - // exit out of Narhwal, Rhino, or RingoJS + } catch(e) { } + + // exit out of Narwhal, Rhino, or RingoJS try { - quit(); + if (details.failed) { + java.lang.System.exit(1); + } else { + quit(); + } } catch(e) { } }; }());