add single quote check to jshint and fix src files for that

[fixes #522]
This commit is contained in:
Robin Böhm
2014-02-16 23:28:20 +01:00
committed by Greg Cobb and Sheel Choksi
parent 095b02ad83
commit 31d71ac22f
30 changed files with 384 additions and 383 deletions

View File

@@ -12,8 +12,8 @@ getJasmineRequireObj().toThrowError = function(j$) {
name,
constructorName;
if (typeof actual != "function") {
throw new Error("Actual is not a Function");
if (typeof actual != 'function') {
throw new Error('Actual is not a Function');
}
extractExpectedParams.apply(null, arguments);
@@ -26,17 +26,17 @@ getJasmineRequireObj().toThrowError = function(j$) {
}
if (!threw) {
fail.message = "Expected function to throw an Error.";
fail.message = 'Expected function to throw an Error.';
return fail;
}
if (!(thrown instanceof Error)) {
fail.message = function() { return "Expected function to throw an Error, but it threw " + j$.pp(thrown) + "."; };
fail.message = function() { return 'Expected function to throw an Error, but it threw ' + j$.pp(thrown) + '.'; };
return fail;
}
if (arguments.length == 1) {
pass.message = "Expected function not to throw an Error, but it threw " + fnNameFor(thrown) + ".";
pass.message = 'Expected function not to throw an Error, but it threw ' + fnNameFor(thrown) + '.';
return pass;
}
@@ -47,54 +47,54 @@ getJasmineRequireObj().toThrowError = function(j$) {
if (errorType && message) {
if (thrown.constructor == errorType && util.equals(thrown.message, message)) {
pass.message = function() { return "Expected function not to throw " + name + " with message " + j$.pp(message) + "."; };
pass.message = function() { return 'Expected function not to throw ' + name + ' with message ' + j$.pp(message) + '.'; };
return pass;
} else {
fail.message = function() { return "Expected function to throw " + name + " with message " + j$.pp(message) +
", but it threw " + constructorName + " with message " + j$.pp(thrown.message) + "."; };
fail.message = function() { return 'Expected function to throw ' + name + ' with message ' + j$.pp(message) +
', but it threw ' + constructorName + ' with message ' + j$.pp(thrown.message) + '.'; };
return fail;
}
}
if (errorType && regexp) {
if (thrown.constructor == errorType && regexp.test(thrown.message)) {
pass.message = function() { return "Expected function not to throw " + name + " with message matching " + j$.pp(regexp) + "."; };
pass.message = function() { return 'Expected function not to throw ' + name + ' with message matching ' + j$.pp(regexp) + '.'; };
return pass;
} else {
fail.message = function() { return "Expected function to throw " + name + " with message matching " + j$.pp(regexp) +
", but it threw " + constructorName + " with message " + j$.pp(thrown.message) + "."; };
fail.message = function() { return 'Expected function to throw ' + name + ' with message matching ' + j$.pp(regexp) +
', but it threw ' + constructorName + ' with message ' + j$.pp(thrown.message) + '.'; };
return fail;
}
}
if (errorType) {
if (thrown.constructor == errorType) {
pass.message = "Expected function not to throw " + name + ".";
pass.message = 'Expected function not to throw ' + name + '.';
return pass;
} else {
fail.message = "Expected function to throw " + name + ", but it threw " + constructorName + ".";
fail.message = 'Expected function to throw ' + name + ', but it threw ' + constructorName + '.';
return fail;
}
}
if (message) {
if (thrown.message == message) {
pass.message = function() { return "Expected function not to throw an exception with message " + j$.pp(message) + "."; };
pass.message = function() { return 'Expected function not to throw an exception with message ' + j$.pp(message) + '.'; };
return pass;
} else {
fail.message = function() { return "Expected function to throw an exception with message " + j$.pp(message) +
", but it threw an exception with message " + j$.pp(thrown.message) + "."; };
fail.message = function() { return 'Expected function to throw an exception with message ' + j$.pp(message) +
', but it threw an exception with message ' + j$.pp(thrown.message) + '.'; };
return fail;
}
}
if (regexp) {
if (regexp.test(thrown.message)) {
pass.message = function() { return "Expected function not to throw an exception with a message matching " + j$.pp(regexp) + "."; };
pass.message = function() { return 'Expected function not to throw an exception with a message matching ' + j$.pp(regexp) + '.'; };
return pass;
} else {
fail.message = function() { return "Expected function to throw an exception with a message matching " + j$.pp(regexp) +
", but it threw an exception with message " + j$.pp(thrown.message) + "."; };
fail.message = function() { return 'Expected function to throw an exception with a message matching ' + j$.pp(regexp) +
', but it threw an exception with message ' + j$.pp(thrown.message) + '.'; };
return fail;
}
}
@@ -113,34 +113,34 @@ getJasmineRequireObj().toThrowError = function(j$) {
if (expected instanceof RegExp) {
regexp = expected;
} else if (typeof expected == "string") {
} else if (typeof expected == 'string') {
message = expected;
} else if (checkForAnErrorType(expected)) {
errorType = expected;
}
if (!(errorType || message || regexp)) {
throw new Error("Expected is not an Error, string, or RegExp.");
throw new Error('Expected is not an Error, string, or RegExp.');
}
} else {
if (checkForAnErrorType(arguments[1])) {
errorType = arguments[1];
} else {
throw new Error("Expected error type is not an Error.");
throw new Error('Expected error type is not an Error.');
}
if (arguments[2] instanceof RegExp) {
regexp = arguments[2];
} else if (typeof arguments[2] == "string") {
} else if (typeof arguments[2] == 'string') {
message = arguments[2];
} else {
throw new Error("Expected error message is not a string or RegExp.");
throw new Error('Expected error message is not a string or RegExp.');
}
}
}
function checkForAnErrorType(type) {
if (typeof type !== "function") {
if (typeof type !== 'function') {
return false;
}