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

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

Issue 10540114: Issue 3528. Additional checks for 'case expressions' (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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 // Test comparison of this and a constant.
6
7 class Foo {
8 static final C1 = const Foo('C1');
9 static final C2 = const Foo('C2');
10 static final C3 = const Foo('C3');
11
12 final name;
13 const Foo(this.name);
14
15 foo() {
16 switch (this) {
17 case C1: return C1;
18 case C2: return C2;
19 default: return null;
20 }
21 }
22 }
23
24 main() {
25 Expect.equals(Foo.C1, Foo.C1.foo());
26 Expect.equals(Foo.C2, Foo.C2.foo());
27 Expect.equals(null, Foo.C3.foo());
28 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698