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