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

Side by Side Diff: test/mjsunit/es6/promises.js

Issue 2690163004: [tests] make the function expression an iife to run the test (Closed)
Patch Set: Created 3 years, 10 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 | no next file » | no next file with comments »
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 964 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 "subclass/resolve/descendant with transplanted own constructor"); 975 "subclass/resolve/descendant with transplanted own constructor");
976 }()); 976 }());
977 977
978 (function() { 978 (function() {
979 var thenCalled = false; 979 var thenCalled = false;
980 980
981 var resolve; 981 var resolve;
982 var promise = new Promise(function(res) { resolve = res; }); 982 var promise = new Promise(function(res) { resolve = res; });
983 resolve({ then() { thenCalled = true; throw new Error(); } }); 983 resolve({ then() { thenCalled = true; throw new Error(); } });
984 assertLater(function() { return thenCalled; }, "resolve-with-thenable"); 984 assertLater(function() { return thenCalled; }, "resolve-with-thenable");
985 }); 985 })();
986 986
987 (function() { 987 (function() {
988 var calledWith; 988 var calledWith;
989 989
990 var resolve; 990 var resolve;
991 var p1 = (new Promise(function(res) { resolve = res; })); 991 var p1 = (new Promise(function(res) { resolve = res; }));
992 var p2 = p1.then(function(v) { 992 var p2 = p1.then(function(v) {
993 return { 993 return {
994 then(resolve, reject) { resolve({ then() { calledWith = v }}); } 994 then(resolve, reject) { resolve({ then() { calledWith = v }}); }
995 }; 995 };
996 }); 996 });
997 997
998 resolve({ then(resolve) { resolve(2); } }); 998 resolve({ then(resolve) { resolve(2); } });
999 assertLater(function() { return calledWith === 2; }, 999 assertLater(function() { return calledWith === 2; },
1000 "resolve-with-thenable2"); 1000 "resolve-with-thenable2");
1001 })(); 1001 })();
1002 1002
1003 (function() { 1003 (function() {
1004 var p = Promise.resolve(); 1004 var p = Promise.resolve();
1005 var callCount = 0; 1005 var callCount = 0;
1006 defineProperty(p, "constructor", { 1006 defineProperty(p, "constructor", {
1007 get: function() { ++callCount; return Promise; } 1007 get: function() { ++callCount; return Promise; }
1008 }); 1008 });
1009 p.then(); 1009 p.then();
1010 assertEquals(1, callCount); 1010 assertEquals(1, callCount);
1011 })(); 1011 })();
1012 1012
1013 assertAsyncDone() 1013 assertAsyncDone()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698