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>()`. | |
karlklose
2013/11/05 11:33:35
We could even assert it so it explodes if someone
Johnni Winther
2013/11/05 12:18:06
Done.
| |
8 void testValue(var o) { | |
9 test(true, () => o is Unresolved, "$o is Unresolved"); | |
10 test(false, () => o is List<Unresolved>, "$o is List<Unresolved>"); | |
11 test(true, () => o is! Unresolved, "$o is! Unresolved"); | |
12 test(false, () => o is! List<Unresolved>, "$o is List<Unresolved>"); | |
13 | |
14 test(true, () => o as Unresolved, "$o as Unresolved"); | |
15 test(false, () => o as List<Unresolved>, "$o as List<Unresolved>"); | |
16 | |
17 test(false, () { | |
18 try { | |
19 } on Unresolved catch (e) { | |
20 } catch (e) { | |
21 } | |
22 }, "on Unresolved catch: Nothing thrown."); | |
23 test(true, () { | |
24 try { | |
25 throw o; | |
26 } on Unresolved catch (e) { | |
27 } catch (e) { | |
28 } | |
29 }, "on Unresolved catch ($o)"); | |
30 test(false, () { | |
31 try { | |
32 throw o; | |
33 } on List<String> catch (e) { | |
34 } on NullThrownError catch (e) { | |
35 } on Unresolved catch (e) { | |
36 } catch (e) { | |
37 } | |
38 }, "on List<String>/NullThrowError catch ($o)"); | |
39 test(false, () { | |
40 try { | |
41 throw o; | |
42 } on List<Unresolved> catch (e) { | |
43 } on NullThrownError catch (e) { | |
44 } on Unresolved catch (e) { | |
45 } catch (e) { | |
46 } | |
47 }, "on List<Unresolved>/NullThrowError catch ($o)"); | |
48 | |
49 test(o != null && inCheckedMode(), | |
50 () { Unresolved u = o; }, | |
51 "Unresolved u = $o;"); | |
52 test(false, | |
53 () { List<Unresolved> u = o; }, | |
54 "List<Unresolved> u = $o;"); | |
55 } | |
OLD | NEW |