OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 |
| 5 part of malformed_test; |
| 6 |
| 7 /// [o] is either `null` or `new List<String>()`. |
| 8 void testValue(var o) { |
| 9 assert(o == null || o is List<String>); |
| 10 |
| 11 test(true, () => o is Unresolved, "$o is Unresolved"); |
| 12 test(false, () => o is List<Unresolved>, "$o is List<Unresolved>"); |
| 13 test(true, () => o is! Unresolved, "$o is! Unresolved"); |
| 14 test(false, () => o is! List<Unresolved>, "$o is List<Unresolved>"); |
| 15 |
| 16 test(true, () => o as Unresolved, "$o as Unresolved"); |
| 17 test(false, () => o as List<Unresolved>, "$o as List<Unresolved>"); |
| 18 |
| 19 test(false, () { |
| 20 try { |
| 21 } on Unresolved catch (e) { |
| 22 } catch (e) { |
| 23 } |
| 24 }, "on Unresolved catch: Nothing thrown."); |
| 25 test(true, () { |
| 26 try { |
| 27 throw o; |
| 28 } on Unresolved catch (e) { |
| 29 } catch (e) { |
| 30 } |
| 31 }, "on Unresolved catch ($o)"); |
| 32 test(false, () { |
| 33 try { |
| 34 throw o; |
| 35 } on List<String> catch (e) { |
| 36 } on NullThrownError catch (e) { |
| 37 } on Unresolved catch (e) { |
| 38 } catch (e) { |
| 39 } |
| 40 }, "on List<String>/NullThrowError catch ($o)"); |
| 41 test(false, () { |
| 42 try { |
| 43 throw o; |
| 44 } on List<Unresolved> catch (e) { |
| 45 } on NullThrownError catch (e) { |
| 46 } on Unresolved catch (e) { |
| 47 } catch (e) { |
| 48 } |
| 49 }, "on List<Unresolved>/NullThrowError catch ($o)"); |
| 50 |
| 51 test(o != null && inCheckedMode(), |
| 52 () { Unresolved u = o; }, |
| 53 "Unresolved u = $o;"); |
| 54 test(false, |
| 55 () { List<Unresolved> u = o; }, |
| 56 "List<Unresolved> u = $o;"); |
| 57 } |
OLD | NEW |