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

Side by Side Diff: tests/language/src/ImpliedInterfaceTest.dart

Issue 10248007: test rename overhaul: step 8 - language tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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
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 class BaseClass {
6 var foo;
7 BaseClass() { foo = 0; }
8 toString() => "BaseClass";
9 }
10
11 /**
12 * This class declaration causes an intentional type warning as it
13 * isn't marked abstract. It is abstract because it doesn't
14 * "implement" the field foo.
15 */
16 class ImplementsClass implements BaseClass {
17 ImplementsClass() {}
18 }
19
20 interface ExtendsClass extends BaseClass {}
21
22 /**
23 * This class declaration causes an intentional type warning as it
24 * isn't marked abstract. It is abstract because it doesn't
25 * "implement" the field foo.
26 */
27 class ImplementsExtendsClass implements ExtendsClass {
28 ImplementsExtendsClass() {}
29 }
30
31 main() {
32 ImplementsClass c1 = new ImplementsClass();
33 ImplementsExtendsClass c2 = new ImplementsExtendsClass();
34 try {
35 c1.foo;
36 Expect.fail('expected a NoSuchMethodException');
37 } catch (NoSuchMethodException ex) {
38 // Expected error.
39 }
40 try {
41 c2.foo;
42 Expect.fail('expected a NoSuchMethodException');
43 } catch (NoSuchMethodException ex) {
44 // Expected error.
45 }
46 Expect.equals(true, c1 is BaseClass);
47 Expect.equals(true, c1 is !ExtendsClass);
48 Expect.equals(true, c2 is BaseClass);
49 Expect.equals(true, c2 is ExtendsClass);
50 Expect.equals(true, c2 is !ImplementsClass);
51 Expect.equals("BaseClass", "${new BaseClass()}");
52
53 // Verify we don't inherit toString from BaseClass
54 Expect.notEquals("BaseClass", "${c1}");
55 Expect.notEquals("BaseClass", "${c2}");
56 }
OLDNEW
« no previous file with comments | « tests/language/src/ImplicitThisTest.dart ('k') | tests/language/src/ImportCoreImplNoPrefixTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698