OLD | NEW |
1 function shouldBeTypeError(toEval) | 1 function shouldBeTypeError(toEval) |
2 { | 2 { |
3 var value = eval(toEval); | 3 var value = eval(toEval); |
4 if (value instanceof TypeError) { | 4 if (value instanceof TypeError) { |
5 testPassed(toEval + " is: " + value.toString()); | 5 testPassed(toEval + " is: " + value.toString()); |
6 } else { | 6 } else { |
7 testFailed(toEval + " is not a TypeError: " + value); | 7 testFailed(toEval + " is not a TypeError: " + value); |
8 } | 8 } |
9 } | 9 } |
10 | 10 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 return new Promise(function(resolve, reject) { | 93 return new Promise(function(resolve, reject) { |
94 self.callbacks.push(resolve); | 94 self.callbacks.push(resolve); |
95 self.channel.port2.postMessage(key); | 95 self.channel.port2.postMessage(key); |
96 }); | 96 }); |
97 } | 97 } |
98 | 98 |
99 // Logging the serialized format ensures that if it changes it will break tests. | 99 // Logging the serialized format ensures that if it changes it will break tests. |
100 function logSerializedKey(o) | 100 function logSerializedKey(o) |
101 { | 101 { |
102 if (internals) | 102 if (internals) { |
103 debug("Serialized key bytes: " + bytesToHexString(internals.serializeObj
ect(o))); | 103 // Removing the version tag from the output so serialization format chan
ges don't need to update all the crypto tests. |
| 104 var serialized = internals.serializeObject(o); |
| 105 var serializedWithoutVersion = new Uint8Array(serialized, 2); |
| 106 debug("Serialized key bytes: " + bytesToHexString(serializedWithoutVersi
on)); |
| 107 } |
104 } | 108 } |
105 | 109 |
106 function shouldEvaluateAs(actual, expectedValue) | 110 function shouldEvaluateAs(actual, expectedValue) |
107 { | 111 { |
108 if (typeof expectedValue == "string") | 112 if (typeof expectedValue == "string") |
109 return shouldBeEqualToString(actual, expectedValue); | 113 return shouldBeEqualToString(actual, expectedValue); |
110 return shouldEvaluateTo(actual, expectedValue); | 114 return shouldEvaluateTo(actual, expectedValue); |
111 } | 115 } |
OLD | NEW |