Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: test/intl/assert.js

Issue 1875153002: [wasm] Also test structured stack trace (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@wasm-throw-error
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/mjsunit/wasm/stack.js » ('j') | test/mjsunit/wasm/stack.js » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 * Throws if two variables have different types or values. 102 * Throws if two variables have different types or values.
103 */ 103 */
104 function assertEquals(expected, found, user_message = '') { 104 function assertEquals(expected, found, user_message = '') {
105 if (!deepEquals(expected, found)) { 105 if (!deepEquals(expected, found)) {
106 fail(expected, found, user_message); 106 fail(expected, found, user_message);
107 } 107 }
108 } 108 }
109 109
110 110
111 /** 111 /**
112 * Throws if value does not contain sub.
113 */
114 function assertContains(value, sub, user_message = '') {
115 if (value == null ? (sub != null) : value.indexOf(sub) == -1) {
116 fail("contains '" + String(sub) + "'", value, user_message);
117 }
118 }
119
120
121 /**
112 * Throws if value is false. 122 * Throws if value is false.
113 */ 123 */
114 function assertTrue(value, user_message = '') { 124 function assertTrue(value, user_message = '') {
115 assertEquals(true, value, user_message); 125 assertEquals(true, value, user_message);
116 } 126 }
117 127
118 128
119 /** 129 /**
120 * Throws if value is true. 130 * Throws if value is true.
121 */ 131 */
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 var actualTypeName = null; 184 var actualTypeName = null;
175 var actualConstructor = Object.prototypeOf(obj).constructor; 185 var actualConstructor = Object.prototypeOf(obj).constructor;
176 if (typeof actualConstructor == "function") { 186 if (typeof actualConstructor == "function") {
177 actualTypeName = actualConstructor.name || String(actualConstructor); 187 actualTypeName = actualConstructor.name || String(actualConstructor);
178 } 188 }
179 throw new Error('Object <' + obj + '> is not an instance of <' + 189 throw new Error('Object <' + obj + '> is not an instance of <' +
180 (type.name || type) + '>' + 190 (type.name || type) + '>' +
181 (actualTypeName ? ' but of < ' + actualTypeName + '>' : '')); 191 (actualTypeName ? ' but of < ' + actualTypeName + '>' : ''));
182 } 192 }
183 } 193 }
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/wasm/stack.js » ('j') | test/mjsunit/wasm/stack.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698