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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 if (internals) | 97 if (internals) |
103 debug("Serialized key bytes: " + bytesToHexString(internals.serializeObj
ect(o))); | 98 debug("Serialized key bytes: " + bytesToHexString(internals.serializeObj
ect(o))); |
104 } | 99 } |
105 | 100 |
106 function shouldEvaluateAs(actual, expectedValue) | 101 function shouldEvaluateAs(actual, expectedValue) |
107 { | 102 { |
108 if (typeof expectedValue == "string") | 103 if (typeof expectedValue == "string") |
109 return shouldBeEqualToString(actual, expectedValue); | 104 return shouldBeEqualToString(actual, expectedValue); |
110 return shouldEvaluateTo(actual, expectedValue); | 105 return shouldEvaluateTo(actual, expectedValue); |
111 } | 106 } |
OLD | NEW |