| 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 | |
| 7 // Test various conditions around instantiating an abstract class. | 5 // Test various conditions around instantiating an abstract class. |
| 8 | 6 |
| 9 // From The Dart Programming Langauge Specification, 11.11.1 "New": | 7 // From The Dart Programming Langauge Specification, 11.11.1 "New": |
| 10 // If q is a constructor of an abstract class then an | 8 // If q is a constructor of an abstract class then an |
| 11 // AbstractClassInstantiation- Error is thrown. | 9 // AbstractClassInstantiation- Error is thrown. |
| 12 | 10 |
| 13 | 11 |
| 14 abstract class Interface { | 12 abstract class Interface { |
| 15 void foo(); | 13 void foo(); |
| 16 } | 14 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 36 } | 34 } |
| 37 | 35 |
| 38 void main() { | 36 void main() { |
| 39 Expect.throws(interface, isAbstractClassInstantiationError, | 37 Expect.throws(interface, isAbstractClassInstantiationError, |
| 40 "expected AbstractClassInstantiationError"); | 38 "expected AbstractClassInstantiationError"); |
| 41 Expect.throws(abstractClass, isAbstractClassInstantiationError, | 39 Expect.throws(abstractClass, isAbstractClassInstantiationError, |
| 42 "expected AbstractClassInstantiationError"); | 40 "expected AbstractClassInstantiationError"); |
| 43 Expect.stringEquals('ConcreteSubclass', '${new ConcreteSubclass()}'); | 41 Expect.stringEquals('ConcreteSubclass', '${new ConcreteSubclass()}'); |
| 44 Expect.stringEquals('NonAbstractClass', '${new NonAbstractClass()}'); | 42 Expect.stringEquals('NonAbstractClass', '${new NonAbstractClass()}'); |
| 45 } | 43 } |
| OLD | NEW |