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 import "package:expect/expect.dart"; | |
6 import 'dart:io'; | 5 import 'dart:io'; |
7 | 6 |
8 void main() { | 7 void main() { |
9 bool developerMode = false; | 8 bool developerMode = false; |
10 assert(developerMode = true); | 9 assert(developerMode = true); |
11 new File('blåbærgrød'); | 10 new File('blåbærgrød'); |
12 new File('foo.txt'); | 11 new File('foo.txt'); |
13 try { | 12 try { |
14 new File(null); | 13 new File(null); |
15 Expect.fail('ArgumentError expected.'); | 14 Expect.fail('ArgumentError expected.'); |
16 } on ArgumentError catch(e) { | 15 } on ArgumentError catch(e) { |
17 // Expected. | 16 // Expected. |
18 } | 17 } |
19 try { | 18 try { |
20 new File(1); | 19 new File(1); |
21 Expect.fail('Error expected.'); | 20 Expect.fail('Error expected.'); |
22 } on ArgumentError catch(e) { | 21 } on ArgumentError catch(e) { |
23 if (developerMode) throw; | 22 if (developerMode) throw; |
24 } on TypeError catch(e) { | 23 } on TypeError catch(e) { |
25 if (!developerMode) throw; | 24 if (!developerMode) throw; |
26 } | 25 } |
27 } | 26 } |
OLD | NEW |