Index: tests/compiler/dart2js/resolver_test.dart |
diff --git a/tests/compiler/dart2js/resolver_test.dart b/tests/compiler/dart2js/resolver_test.dart |
index 5c02c5b6ae87b239af6ddc91f93003dde7398b2b..18aa61025ce27aa87100d8f326cbfc4e8ab79d82 100644 |
--- a/tests/compiler/dart2js/resolver_test.dart |
+++ b/tests/compiler/dart2js/resolver_test.dart |
@@ -76,6 +76,7 @@ main() { |
testNewExpression, |
testTopLevelFields, |
testClassHierarchy, |
+ testEnumDeclaration, |
testInitializers, |
testThis, |
testSuperCalls, |
@@ -806,6 +807,66 @@ Future testClassHierarchy() { |
]); |
} |
+Future testEnumDeclaration() { |
+ final MAIN = "main"; |
+ return Future.wait([ |
+ MockCompiler.create((MockCompiler compiler) { |
+ compiler.parseScript("""enum Enum {} |
+ main() { Enum e; }"""); |
+ FunctionElement mainElement = compiler.mainApp.find(MAIN); |
+ compiler.resolver.resolve(mainElement); |
+ Expect.equals(0, compiler.warnings.length, |
+ 'Unexpected warnings: ${compiler.warnings}'); |
+ Expect.equals(0, compiler.errors.length, |
+ 'Unexpected errors: ${compiler.errors}'); |
+ }, enableEnums: true), |
+ MockCompiler.create((MockCompiler compiler) { |
+ compiler.parseScript("""enum Enum {} |
+ main() { Enum e = Enum.A; }"""); |
+ FunctionElement mainElement = compiler.mainApp.find(MAIN); |
+ compiler.resolver.resolve(mainElement); |
+ Expect.equals(1, compiler.warnings.length, |
+ 'Unexpected warnings: ${compiler.warnings}'); |
+ Expect.equals(MessageKind.MEMBER_NOT_FOUND, |
+ compiler.warnings[0].message.kind); |
+ Expect.equals(0, compiler.errors.length, |
+ 'Unexpected errors: ${compiler.errors}'); |
+ }, enableEnums: true), |
+ MockCompiler.create((MockCompiler compiler) { |
+ compiler.parseScript("""enum Enum { A } |
+ main() { Enum e = Enum.A; }"""); |
+ FunctionElement mainElement = compiler.mainApp.find(MAIN); |
+ compiler.resolver.resolve(mainElement); |
+ Expect.equals(0, compiler.warnings.length, |
+ 'Unexpected warnings: ${compiler.warnings}'); |
+ Expect.equals(0, compiler.errors.length, |
+ 'Unexpected errors: ${compiler.errors}'); |
+ }, enableEnums: true), |
+ MockCompiler.create((MockCompiler compiler) { |
+ compiler.parseScript("""enum Enum { A } |
+ main() { Enum e = Enum.B; }"""); |
+ FunctionElement mainElement = compiler.mainApp.find(MAIN); |
+ compiler.resolver.resolve(mainElement); |
+ Expect.equals(1, compiler.warnings.length, |
+ 'Unexpected warnings: ${compiler.warnings}'); |
+ Expect.equals(MessageKind.MEMBER_NOT_FOUND, |
+ compiler.warnings[0].message.kind); |
+ Expect.equals(0, compiler.errors.length, |
+ 'Unexpected errors: ${compiler.errors}'); |
+ }, enableEnums: true), |
+ MockCompiler.create((MockCompiler compiler) { |
+ compiler.parseScript("""enum Enum { A } |
+ main() { List values = Enum.values; }"""); |
+ FunctionElement mainElement = compiler.mainApp.find(MAIN); |
+ compiler.resolver.resolve(mainElement); |
+ Expect.equals(0, compiler.warnings.length, |
+ 'Unexpected warnings: ${compiler.warnings}'); |
+ Expect.equals(0, compiler.errors.length, |
+ 'Unexpected errors: ${compiler.errors}'); |
+ }, enableEnums: true), |
+ ]); |
+} |
+ |
Future testInitializers() { |
return Future.forEach([ |
() { |