| OLD | NEW |
| 1 function shouldBeTypeError(toEval) | 1 function logError(error) |
| 2 { | 2 { |
| 3 var value = eval(toEval); | 3 debug("error is: " + error.toString()); |
| 4 if (value instanceof TypeError) { | |
| 5 testPassed(toEval + " is: " + value.toString()); | |
| 6 } else { | |
| 7 testFailed(toEval + " is not a TypeError: " + value); | |
| 8 } | |
| 9 } | 4 } |
| 10 | 5 |
| 11 // Verifies that the given "bytes" holds the same value as "expectedHexString". | 6 // Verifies that the given "bytes" holds the same value as "expectedHexString". |
| 12 // "bytes" can be anything recognized by "bytesToHexString()". | 7 // "bytes" can be anything recognized by "bytesToHexString()". |
| 13 function bytesShouldMatchHexString(testDescription, expectedHexString, bytes) | 8 function bytesShouldMatchHexString(testDescription, expectedHexString, bytes) |
| 14 { | 9 { |
| 15 expectedHexString = "[" + expectedHexString.toLowerCase() + "]"; | 10 expectedHexString = "[" + expectedHexString.toLowerCase() + "]"; |
| 16 var actualHexString = "[" + bytesToHexString(bytes) + "]"; | 11 var actualHexString = "[" + bytesToHexString(bytes) + "]"; |
| 17 | 12 |
| 18 if (actualHexString === expectedHexString) { | 13 if (actualHexString === expectedHexString) { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 debug("Serialized key bytes: " + bytesToHexString(serializedWithoutVersi
on)); | 101 debug("Serialized key bytes: " + bytesToHexString(serializedWithoutVersi
on)); |
| 107 } | 102 } |
| 108 } | 103 } |
| 109 | 104 |
| 110 function shouldEvaluateAs(actual, expectedValue) | 105 function shouldEvaluateAs(actual, expectedValue) |
| 111 { | 106 { |
| 112 if (typeof expectedValue == "string") | 107 if (typeof expectedValue == "string") |
| 113 return shouldBeEqualToString(actual, expectedValue); | 108 return shouldBeEqualToString(actual, expectedValue); |
| 114 return shouldEvaluateTo(actual, expectedValue); | 109 return shouldEvaluateTo(actual, expectedValue); |
| 115 } | 110 } |
| OLD | NEW |