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

Side by Side Diff: test/webkit/resources/standalone-pre.js

Issue 1109783003: Import JSC class tests (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: git rebase Created 5 years, 7 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/webkit/class-syntax-super-expected.txt ('k') | 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 // Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 2 // Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions 5 // modification, are permitted provided that the following conditions
6 // are met: 6 // are met:
7 // 1. Redistributions of source code must retain the above copyright 7 // 1. Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer. 8 // notice, this list of conditions and the following disclaimer.
9 // 2. Redistributions in binary form must reproduce the above copyright 9 // 2. Redistributions in binary form must reproduce the above copyright
10 // notice, this list of conditions and the following disclaimer in the 10 // notice, this list of conditions and the following disclaimer in the
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 return true; 82 return true;
83 if (typeof(_expected) == "number" && isNaN(_expected)) 83 if (typeof(_expected) == "number" && isNaN(_expected))
84 return typeof(_actual) == "number" && isNaN(_actual); 84 return typeof(_actual) == "number" && isNaN(_actual);
85 if (Object.prototype.toString.call(_expected) == Object.prototype.toString.c all([])) 85 if (Object.prototype.toString.call(_expected) == Object.prototype.toString.c all([]))
86 return areArraysEqual(_actual, _expected); 86 return areArraysEqual(_actual, _expected);
87 return false; 87 return false;
88 } 88 }
89 89
90 function stringify(v) 90 function stringify(v)
91 { 91 {
92 if (v)
93 return v.toString();
92 if (v === 0 && 1/v < 0) 94 if (v === 0 && 1/v < 0)
93 return "-0"; 95 return "-0";
94 else return "" + v; 96 else
97 return "" + v;
95 } 98 }
96 99
97 function shouldBe(_a, _b) 100 function shouldBe(_a, _b)
98 { 101 {
99 if (typeof _a != "string" || typeof _b != "string") 102 if (typeof _a != "string" || typeof _b != "string")
100 debug("WARN: shouldBe() expects string arguments"); 103 debug("WARN: shouldBe() expects string arguments");
101 var exception; 104 var exception;
102 var _av; 105 var _av;
103 try { 106 try {
104 _av = eval(_a); 107 _av = eval(_a);
105 } catch (e) { 108 } catch (e) {
106 exception = e; 109 exception = e;
107 } 110 }
108 var _bv = eval(_b); 111 var _bv = eval(_b);
109 112
110 if (exception) 113 if (exception)
111 testFailed(_a + " should be " + _bv + ". Threw exception " + exception); 114 testFailed(_a + " should be " + _bv + ". Threw exception " + exception);
112 else if (isResultCorrect(_av, _bv)) 115 else if (isResultCorrect(_av, _bv))
113 testPassed(_a + " is " + _b); 116 testPassed(_a + " is " + _b);
114 else if (typeof(_av) == typeof(_bv)) 117 else if (typeof(_av) == typeof(_bv))
115 testFailed(_a + " should be " + _bv + ". Was " + stringify(_av) + "."); 118 testFailed(_a + " should be " + _bv + ". Was " + stringify(_av) + ".");
116 else 119 else
117 testFailed(_a + " should be " + _bv + " (of type " + typeof _bv + "). Was " + _av + " (of type " + typeof _av + ")."); 120 testFailed(_a + " should be " + _bv + " (of type " + typeof _bv + "). Was " + stringify(_av) + " (of type " + typeof _av + ").");
118 } 121 }
119 122
120 function shouldBeTrue(_a) { shouldBe(_a, "true"); } 123 function shouldBeTrue(_a) { shouldBe(_a, "true"); }
121 function shouldBeFalse(_a) { shouldBe(_a, "false"); } 124 function shouldBeFalse(_a) { shouldBe(_a, "false"); }
122 function shouldBeNaN(_a) { shouldBe(_a, "NaN"); } 125 function shouldBeNaN(_a) { shouldBe(_a, "NaN"); }
123 function shouldBeNull(_a) { shouldBe(_a, "null"); } 126 function shouldBeNull(_a) { shouldBe(_a, "null"); }
124 127
125 function shouldBeEqualToString(a, b) 128 function shouldBeEqualToString(a, b)
126 { 129 {
127 if (typeof a !== "string" || typeof b !== "string") 130 if (typeof a !== "string" || typeof b !== "string")
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 _ev = eval(_e); 167 _ev = eval(_e);
165 168
166 if (exception) { 169 if (exception) {
167 if (typeof _e == "undefined" || exception == _ev) 170 if (typeof _e == "undefined" || exception == _ev)
168 testPassed(_a + " threw exception " + exception + "."); 171 testPassed(_a + " threw exception " + exception + ".");
169 else 172 else
170 testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an excepti on" : _ev) + ". Threw exception " + exception + "."); 173 testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an excepti on" : _ev) + ". Threw exception " + exception + ".");
171 } else if (typeof _av == "undefined") 174 } else if (typeof _av == "undefined")
172 testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception " : _ev) + ". Was undefined."); 175 testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception " : _ev) + ". Was undefined.");
173 else 176 else
174 testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception " : _ev) + ". Was " + _av + "."); 177 testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception " : _ev) + ". Was " + stringify(_av) + ".");
178 }
179
180
181 function shouldNotThrow(_a)
182 {
183 try {
184 eval(_a);
185 testPassed(_a + " did not throw exception.");
186 } catch (e) {
187 testFailed(_a + " should not throw exception. Threw exception " + e + ". ");
188 }
175 } 189 }
176 190
177 function isSuccessfullyParsed() 191 function isSuccessfullyParsed()
178 { 192 {
179 successfullyParsed = true; 193 successfullyParsed = true;
180 shouldBeTrue("successfullyParsed"); 194 shouldBeTrue("successfullyParsed");
181 debug("\nTEST COMPLETE\n"); 195 debug("\nTEST COMPLETE\n");
182 } 196 }
183 197
184 // It's possible for an async test to call finishJSTest() before js-test-post.js 198 // It's possible for an async test to call finishJSTest() before js-test-post.js
185 // has been parsed. 199 // has been parsed.
186 function finishJSTest() 200 function finishJSTest()
187 { 201 {
188 wasFinishJSTestCalled = true; 202 wasFinishJSTestCalled = true;
189 if (!wasPostTestScriptParsed) 203 if (!wasPostTestScriptParsed)
190 return; 204 return;
191 isSuccessfullyParsed(); 205 isSuccessfullyParsed();
192 } 206 }
OLDNEW
« no previous file with comments | « test/webkit/class-syntax-super-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698