OLD | NEW |
| 1 function shouldBeTypeError(toEval) |
| 2 { |
| 3 var value = eval(toEval); |
| 4 if (value instanceof TypeError) { |
| 5 testPassed(toEval + " is: " + value.toString()); |
| 6 } else { |
| 7 testFailed(toEval + " is not a TypeError: " + value); |
| 8 } |
| 9 } |
| 10 |
1 // Verifies that the given "bytes" holds the same value as "expectedHexString". | 11 // Verifies that the given "bytes" holds the same value as "expectedHexString". |
2 // "bytes" can be anything recognized by "bytesToHexString()". | 12 // "bytes" can be anything recognized by "bytesToHexString()". |
3 function bytesShouldMatchHexString(testDescription, expectedHexString, bytes) | 13 function bytesShouldMatchHexString(testDescription, expectedHexString, bytes) |
4 { | 14 { |
5 expectedHexString = "[" + expectedHexString.toLowerCase() + "]"; | 15 expectedHexString = "[" + expectedHexString.toLowerCase() + "]"; |
6 var actualHexString = "[" + bytesToHexString(bytes) + "]"; | 16 var actualHexString = "[" + bytesToHexString(bytes) + "]"; |
7 | 17 |
8 if (actualHexString === expectedHexString) { | 18 if (actualHexString === expectedHexString) { |
9 debug("PASS: " + testDescription + " should be " + expectedHexString + "
and was"); | 19 debug("PASS: " + testDescription + " should be " + expectedHexString + "
and was"); |
10 } else { | 20 } else { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 if (internals) | 102 if (internals) |
93 debug("Serialized key bytes: " + bytesToHexString(internals.serializeObj
ect(o))); | 103 debug("Serialized key bytes: " + bytesToHexString(internals.serializeObj
ect(o))); |
94 } | 104 } |
95 | 105 |
96 function shouldEvaluateAs(actual, expectedValue) | 106 function shouldEvaluateAs(actual, expectedValue) |
97 { | 107 { |
98 if (typeof expectedValue == "string") | 108 if (typeof expectedValue == "string") |
99 return shouldBeEqualToString(actual, expectedValue); | 109 return shouldBeEqualToString(actual, expectedValue); |
100 return shouldEvaluateTo(actual, expectedValue); | 110 return shouldEvaluateTo(actual, expectedValue); |
101 } | 111 } |
OLD | NEW |