Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(466)

Side by Side Diff: dart/tests/language/abstract_runtime_error_test.dart

Issue 11017052: Test of AbstractClassInstantiationError. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | dart/tests/language/language_dart2js.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Test various conditions around instantiating an abstract class.
6
7 // From The Dart Programming Langauge Specification, 11.11.1 "New":
8 // If q is a constructor of an abstract class then an
9 // AbstractClassInstantiation- Error is thrown.
10
11
12 abstract class Interface {
13 void foo();
14 }
15
16 abstract class AbstractClass {
17 toString() => 'AbstractClass';
18 }
19
20 class ConcreteSubclass extends AbstractClass {
21 toString() => 'ConcreteSubclass';
22 }
23
24 class NonAbstractClass implements Interface {
25 toString() => 'NonAbstractClass';
26 }
27
28 void main() {
29 try {
kasperl 2012/10/10 08:43:49 Maybe use: Expect.throws(() => new Interface(),
ahe 2012/10/10 09:27:21 Done.
30 new Interface();
31 throw 'AbstractClassInstantiationError expected';
32 } on AbstractClassInstantiationError {
33 // OK
34 }
35
36 try {
37 new AbstractClass();
38 throw 'AbstractClassInstantiationError expected';
39 } on AbstractClassInstantiationError {
40 // OK
41 }
42
43 Expect.stringEquals('ConcreteSubclass', '${new ConcreteSubclass()}');
44 Expect.stringEquals('NonAbstractClass', '${new NonAbstractClass()}');
45 }
OLDNEW
« no previous file with comments | « no previous file | dart/tests/language/language_dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698