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

Side by Side Diff: test/mjsunit/error-tostring.js

Issue 1507273002: Make Error.prototype.toString spec compliant; and fix various side-effect-free error printing metho… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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
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 23 matching lines...) Expand all
34 34
35 // Test printing of cyclic errors which return the empty string for 35 // Test printing of cyclic errors which return the empty string for
36 // compatibility with Safari and Firefox. 36 // compatibility with Safari and Firefox.
37 37
38 e = new Error(); 38 e = new Error();
39 e.name = e; 39 e.name = e;
40 e.message = e; 40 e.message = e;
41 e.stack = "Does not occur in output"; 41 e.stack = "Does not occur in output";
42 e.arguments = "Does not occur in output"; 42 e.arguments = "Does not occur in output";
43 e.type = "Does not occur in output"; 43 e.type = "Does not occur in output";
44 assertEquals('', e.toString()); 44 assertThrows(()=>e.toString(), RangeError);
45 45
46 e = new Error(); 46 e = new Error();
47 e.name = [ e ]; 47 e.name = [ e ];
48 e.message = [ e ]; 48 e.message = [ e ];
49 e.stack = "Does not occur in output"; 49 e.stack = "Does not occur in output";
50 e.arguments = "Does not occur in output"; 50 e.arguments = "Does not occur in output";
51 e.type = "Does not occur in output"; 51 e.type = "Does not occur in output";
52 assertEquals('', e.toString()); 52 assertEquals('', e.toString());
53 53
54 54
(...skipping 29 matching lines...) Expand all
84 assertEquals(["e2",[1,2,3,4]], testErrorToString("", "e2")); 84 assertEquals(["e2",[1,2,3,4]], testErrorToString("", "e2"));
85 assertEquals(["e1: e2",[1,2,3,4]], testErrorToString("e1", "e2")); 85 assertEquals(["e1: e2",[1,2,3,4]], testErrorToString("e1", "e2"));
86 86
87 var obj = { 87 var obj = {
88 get constructor () { 88 get constructor () {
89 assertUnreachable(); 89 assertUnreachable();
90 } 90 }
91 }; 91 };
92 92
93 assertThrows(function() { obj.x(); }); 93 assertThrows(function() { obj.x(); });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698