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

Side by Side Diff: test/mjsunit/harmony/proxies-with.js

Issue 1544793002: [tests] Fix bogus uses of assertThrows. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 11 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 | « test/mjsunit/harmony/proxies-for.js ('k') | test/mjsunit/harmony/reflect.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 161
162 function TestWithGetCallThrow(handler) { 162 function TestWithGetCallThrow(handler) {
163 TestWithProxies(TestWithGetCallThrow2, handler) 163 TestWithProxies(TestWithGetCallThrow2, handler)
164 } 164 }
165 165
166 function TestWithGetCallThrow2(create, handler) { 166 function TestWithGetCallThrow2(create, handler) {
167 var b = function() { return "local" } 167 var b = function() { return "local" }
168 168
169 var p = create(handler) 169 var p = create(handler)
170 with (p) { 170 with (p) {
171 assertThrows(function(){ a() }, "myexn") 171 assertThrowsEquals(function(){ a() }, "myexn")
172 assertEquals("local", b()) 172 assertEquals("local", b())
173 assertEquals("global", c()) 173 assertEquals("global", c())
174 } 174 }
175 175
176 var o = Object.create(p, {d: {value: function() { return "own" }}}) 176 var o = Object.create(p, {d: {value: function() { return "own" }}})
177 with (o) { 177 with (o) {
178 assertThrows(function(){ a() }, "myexn") 178 assertThrowsEquals(function(){ a() }, "myexn")
179 assertEquals("local", b()) 179 assertEquals("local", b())
180 assertEquals("global", c()) 180 assertEquals("global", c())
181 assertEquals("own", d()) 181 assertEquals("own", d())
182 } 182 }
183 } 183 }
184 184
185 function onproxythrow() { throw "myexn" } 185 function onproxythrow() { throw "myexn" }
186 186
187 TestWithGetCallThrow({ 187 TestWithGetCallThrow({
188 has: function(r, k) { return k === "a"; },
188 get: function(r, k) { key = k; return k === "a" ? onproxythrow : undefined }, 189 get: function(r, k) { key = k; return k === "a" ? onproxythrow : undefined },
189 }) 190 })
190 191
191 TestWithGetCallThrow({ 192 TestWithGetCallThrow({
193 has: function(r, k) { return k === "a"; },
192 get: function(r, k) { return this.get2(r, k) }, 194 get: function(r, k) { return this.get2(r, k) },
193 get2: function(r, k) { key = k; return k === "a" ? onproxythrow : undefined }, 195 get2: function(r, k) { key = k; return k === "a" ? onproxythrow : undefined },
194 }) 196 })
195 197
196 198
197 199
198 // Setting. 200 // Setting.
199 201
200 var key 202 var key
201 var val 203 var val
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 defineProperty: function(t, k, desc) { key = k; val = desc.value } 300 defineProperty: function(t, k, desc) { key = k; val = desc.value }
299 }) 301 })
300 302
301 303
302 function TestWithSetThrow(handler, hasSetter) { 304 function TestWithSetThrow(handler, hasSetter) {
303 TestWithProxies(TestWithSetThrow2, handler, hasSetter) 305 TestWithProxies(TestWithSetThrow2, handler, hasSetter)
304 } 306 }
305 307
306 function TestWithSetThrow2(create, handler, hasSetter) { 308 function TestWithSetThrow2(create, handler, hasSetter) {
307 var p = create(handler) 309 var p = create(handler)
308 assertThrows(function(){ 310 assertThrowsEquals(function(){
309 with (p) { 311 with (p) {
310 a = 1 312 a = 1
311 } 313 }
312 }, "myexn") 314 }, "myexn")
313 315
314 if (!hasSetter) return 316 if (!hasSetter) return
315 317
316 var o = Object.create(p, {}) 318 var o = Object.create(p, {})
317 assertThrows(function(){ 319 assertThrowsEquals(function(){
318 with (o) { 320 with (o) {
319 a = 1 321 a = 1
320 } 322 }
321 }, "myexn") 323 }, "myexn")
322 } 324 }
323 325
324 TestWithSetThrow({ 326 TestWithSetThrow({
325 set: function() { throw "myexn" }, 327 set: function() { throw "myexn" },
326 has: function(t, k) { 328 has: function(t, k) {
327 return k === "a" 329 return k === "a"
(...skipping 14 matching lines...) Expand all
342 }, 344 },
343 defineProperty: function() { throw "myexn" } 345 defineProperty: function() { throw "myexn" }
344 }) 346 })
345 347
346 TestWithSetThrow({ 348 TestWithSetThrow({
347 has: function(t, k) { 349 has: function(t, k) {
348 return k === "a" 350 return k === "a"
349 }, 351 },
350 set: function() { throw "myexn" } 352 set: function() { throw "myexn" }
351 }, true) 353 }, true)
OLDNEW
« no previous file with comments | « test/mjsunit/harmony/proxies-for.js ('k') | test/mjsunit/harmony/reflect.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698