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

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

Issue 2765693002: Update all tests (Closed)
Patch Set: Created 3 years, 9 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 // Basic syntax test for enumeration types 5 // Basic syntax test for enumeration types
6 6
7 import 'package:expect/expect.dart'; 7 import 'package:expect/expect.dart';
8 8
9 9
10 enum Color { red, orange, yellow, green } 10 enum Color { red, orange, yellow, green }
11 11
12 // Additional comma at end of list is ok. 12 // Additional comma at end of list is ok.
13 enum Veggies { carrot, bean, broccolo, } 13 enum Veggies { carrot, bean, broccolo, }
14 14
15 // Need at least one enumeration identifier. 15 // Need at least one enumeration identifier.
16 enum Nada {} /// 01: compile-time error 16 enum Nada {} //# 01: compile-time error
17 17
18 // Duplicate entries are a compile-time error 18 // Duplicate entries are a compile-time error
19 enum ComeAgain { ahau, knust, zipfel, knust, gupf } /// 02: compile-time error 19 enum ComeAgain { ahau, knust, zipfel, knust, gupf } //# 02: compile-time error
20 20
21 // Enum entries must not collide with implicitly defined members. 21 // Enum entries must not collide with implicitly defined members.
22 enum ComeAgain { ahau, knust, zipfel, index } /// 03: compile-time error 22 enum ComeAgain { ahau, knust, zipfel, index } //# 03: compile-time error
23 23
24 enum ComeAgain { ahau, knust, zipfel, values } /// 04: compile-time error 24 enum ComeAgain { ahau, knust, zipfel, values } //# 04: compile-time error
25 25
26 enum ComeAgain { ahau, knust, zipfel, toString } /// 05: compile-time error 26 enum ComeAgain { ahau, knust, zipfel, toString } //# 05: compile-time error
27 27
28 // Enum entry must not collide with enum type name. 28 // Enum entry must not collide with enum type name.
29 enum ComeAgain { ahau, knust, zipfel, ComeAgain } /// 06: compile-time error 29 enum ComeAgain { ahau, knust, zipfel, ComeAgain } //# 06: compile-time error
30 30
31 // Missing comma. 31 // Missing comma.
32 enum Numbers { one, two, three four, five } /// 07: compile-time error 32 enum Numbers { one, two, three four, five } //# 07: compile-time error
33 33
34 // Missing enum type name. 34 // Missing enum type name.
35 enum { eins, zwei, drei } /// 08: compile-time error 35 enum { eins, zwei, drei } //# 08: compile-time error
36 36
37 // Duplicate name in library scope. 37 // Duplicate name in library scope.
38 topLevelFunction() => null; 38 topLevelFunction() => null;
39 enum topLevelFunction { bla, blah } /// 09: compile-time error 39 enum topLevelFunction { bla, blah } //# 09: compile-time error
40 40
41 class C {} 41 class C {}
42 enum C { bla, blah } /// 10: compile-time error 42 enum C { bla, blah } //# 10: compile-time error
43 43
44 var zzTop; 44 var zzTop;
45 enum zzTop { Billy, Dusty, Frank } /// 11: compile-time error 45 enum zzTop { Billy, Dusty, Frank } //# 11: compile-time error
46 46
47 // Enum type cannot be super type or interface type. 47 // Enum type cannot be super type or interface type.
48 class Rainbow extends Color {} /// 20: compile-time error 48 class Rainbow extends Color {} //# 20: compile-time error
49 class Rainbow implements Color {} /// 21: compile-time error 49 class Rainbow implements Color {} //# 21: compile-time error
50 class Rainbow extends List with Color {} /// 22: compile-time error 50 class Rainbow extends List with Color {} //# 22: compile-time error
51 51
52 main() { 52 main() {
53 Nada x; /// 01: continued 53 Nada x; //# 01: continued
54 var x = ComeAgain.zipfel; /// 02: continued 54 var x = ComeAgain.zipfel; //# 02: continued
55 var x = ComeAgain.zipfel; /// 03: continued 55 var x = ComeAgain.zipfel; //# 03: continued
56 var x = ComeAgain.zipfel; /// 04: continued 56 var x = ComeAgain.zipfel; //# 04: continued
57 var x = ComeAgain.zipfel; /// 05: continued 57 var x = ComeAgain.zipfel; //# 05: continued
58 var x = ComeAgain.zipfel; /// 06: continued 58 var x = ComeAgain.zipfel; //# 06: continued
59 var x = Numbers.four; /// 07: continued 59 var x = Numbers.four; //# 07: continued
60 var x = topLevelFunction.bla; /// 09: continued 60 var x = topLevelFunction.bla; //# 09: continued
61 var x = C.bla; /// 10: continued 61 var x = C.bla; //# 10: continued
62 var x = zzTop.Frank; /// 11: continued 62 var x = zzTop.Frank; //# 11: continued
63 63
64 var x = new Rainbow(); /// 20: continued 64 var x = new Rainbow(); //# 20: continued
65 var x = new Rainbow(); /// 21: continued 65 var x = new Rainbow(); //# 21: continued
66 var x = new Rainbow(); /// 22: continued 66 var x = new Rainbow(); //# 22: continued
67 67
68 // It is a compile-time error to explicitly instantiate an enum instance. 68 // It is a compile-time error to explicitly instantiate an enum instance.
69 var x = new Color(); /// 30: compile-time error 69 var x = new Color(); //# 30: compile-time error
70 } 70 }
71 71
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698