OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // TODO(ahe): This is a copy of | 5 // TODO(ahe): This is a copy of |
6 // ../../../../tests/language/src/NamingTest.dart and should be | 6 // ../../../../tests/language/src/NamingTest.dart and should be |
7 // deleted when the one TODO below is addressed. | 7 // deleted when the one TODO below is addressed. |
8 | 8 |
9 class A { | 9 class A { |
10 A() { NamingTest.count++; } | 10 A() { NamingTest.count++; } |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 class NamingTest { | 206 class NamingTest { |
207 static int count; | 207 static int count; |
208 | 208 |
209 static testExceptionNaming() { | 209 static testExceptionNaming() { |
210 // Exceptions use a hardcoded "e" as exception name. If the namer works | 210 // Exceptions use a hardcoded "e" as exception name. If the namer works |
211 // correctly then it will be renamed in case of clashes. | 211 // correctly then it will be renamed in case of clashes. |
212 var e = 3; | 212 var e = 3; |
213 var caught = false; | 213 var caught = false; |
214 try { | 214 try { |
215 throw new MyException(); | 215 throw new MyException(); |
216 } catch (var exc) { | 216 } catch (exc) { |
217 try { | 217 try { |
218 throw new MyException(); | 218 throw new MyException(); |
219 } catch (var exc2) { | 219 } catch (exc2) { |
220 exc = 9; | 220 exc = 9; |
221 } | 221 } |
222 Expect.equals(9, exc); | 222 Expect.equals(9, exc); |
223 caught = true; | 223 caught = true; |
224 } | 224 } |
225 Expect.equals(true, caught); | 225 Expect.equals(true, caught); |
226 Expect.equals(3, e); | 226 Expect.equals(3, e); |
227 } | 227 } |
228 | 228 |
229 static testTmpNaming() { | 229 static testTmpNaming() { |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 Expect.equals(38, x.y); | 389 Expect.equals(38, x.y); |
390 x = new with$I$C.$(0, 0); | 390 x = new with$I$C.$(0, 0); |
391 Expect.equals(9, x.x); | 391 Expect.equals(9, x.x); |
392 Expect.equals(39, x.y); | 392 Expect.equals(39, x.y); |
393 x = new with$I$C.$$(0, 0); | 393 x = new with$I$C.$$(0, 0); |
394 Expect.equals(10, x.x); | 394 Expect.equals(10, x.x); |
395 Expect.equals(40, x.y); | 395 Expect.equals(40, x.y); |
396 var wasCaught = false; | 396 var wasCaught = false; |
397 try { | 397 try { |
398 throw new with(0, 0); | 398 throw new with(0, 0); |
399 } catch(with e) { | 399 } on with catch (e) { |
400 wasCaught = true; | 400 wasCaught = true; |
401 Expect.equals(5, e.x); | 401 Expect.equals(5, e.x); |
402 } | 402 } |
403 Expect.equals(true, wasCaught); | 403 Expect.equals(true, wasCaught); |
404 } | 404 } |
405 | 405 |
406 static void testMemberMangling() { | 406 static void testMemberMangling() { |
407 Expect.equals(5, debugger.__PROTO__); | 407 Expect.equals(5, debugger.__PROTO__); |
408 new Toto().titi(); | 408 new Toto().titi(); |
409 } | 409 } |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 var a = new Naming2Test(); | 517 var a = new Naming2Test(); |
518 Expect.throws(() => a.foo(2), (e) => e is ObjectNotClosureException); | 518 Expect.throws(() => a.foo(2), (e) => e is ObjectNotClosureException); |
519 } | 519 } |
520 } | 520 } |
521 | 521 |
522 main() { | 522 main() { |
523 NamingTest.testMain(); | 523 NamingTest.testMain(); |
524 Naming1Test.main(null); | 524 Naming1Test.main(null); |
525 Naming2Test.main(null); | 525 Naming2Test.main(null); |
526 } | 526 } |
OLD | NEW |