| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 } | 106 } |
| 107 | 107 |
| 108 | 108 |
| 109 function assertNaN(value, name_opt) { | 109 function assertNaN(value, name_opt) { |
| 110 if (!isNaN(value)) { | 110 if (!isNaN(value)) { |
| 111 fail("NaN", value, name_opt); | 111 fail("NaN", value, name_opt); |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 | 114 |
| 115 | 115 |
| 116 function assertNull(value, name_opt) { |
| 117 if (value !== null) { |
| 118 fail("null", value, name_opt); |
| 119 } |
| 120 } |
| 121 |
| 122 |
| 123 function assertNotNull(value, name_opt) { |
| 124 if (value === null) { |
| 125 fail("not null", value, name_opt); |
| 126 } |
| 127 } |
| 128 |
| 129 |
| 116 function assertThrows(code) { | 130 function assertThrows(code) { |
| 117 var threwException = true; | 131 var threwException = true; |
| 118 try { | 132 try { |
| 119 eval(code); | 133 eval(code); |
| 120 threwException = false; | 134 threwException = false; |
| 121 } catch (e) { | 135 } catch (e) { |
| 122 // Do nothing. | 136 // Do nothing. |
| 123 } | 137 } |
| 124 if (!threwException) assertTrue(false, "did not throw exception"); | 138 if (!threwException) assertTrue(false, "did not throw exception"); |
| 125 } | 139 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 142 | 156 |
| 143 | 157 |
| 144 function assertUnreachable(name_opt) { | 158 function assertUnreachable(name_opt) { |
| 145 // Fix this when we ditch the old test runner. | 159 // Fix this when we ditch the old test runner. |
| 146 var message = "Fail" + "ure: unreachable" | 160 var message = "Fail" + "ure: unreachable" |
| 147 if (name_opt) { | 161 if (name_opt) { |
| 148 message += " - " + name_opt; | 162 message += " - " + name_opt; |
| 149 } | 163 } |
| 150 throw new MjsUnitAssertionError(message); | 164 throw new MjsUnitAssertionError(message); |
| 151 } | 165 } |
| OLD | NEW |