| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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 package com.google.dart.compiler.end2end.inc; | 4 package com.google.dart.compiler.end2end.inc; |
| 5 | 5 |
| 6 import com.google.common.collect.Lists; | 6 import com.google.common.collect.Lists; |
| 7 import com.google.common.collect.Maps; | 7 import com.google.common.collect.Maps; |
| 8 import com.google.common.collect.Sets; | 8 import com.google.common.collect.Sets; |
| 9 import com.google.dart.compiler.CompilerTestCase; | 9 import com.google.dart.compiler.CompilerTestCase; |
| 10 import com.google.dart.compiler.DartCompilationError; | 10 import com.google.dart.compiler.DartCompilationError; |
| 11 import com.google.dart.compiler.DartCompiler; | 11 import com.google.dart.compiler.DartCompiler; |
| 12 import com.google.dart.compiler.DartCompilerErrorCode; | 12 import com.google.dart.compiler.DartCompilerErrorCode; |
| 13 import com.google.dart.compiler.DartCompilerListener; | 13 import com.google.dart.compiler.DartCompilerListener; |
| 14 import com.google.dart.compiler.DartSource; | 14 import com.google.dart.compiler.DartSource; |
| 15 import com.google.dart.compiler.DefaultCompilerConfiguration; | 15 import com.google.dart.compiler.DefaultCompilerConfiguration; |
| 16 import com.google.dart.compiler.LibrarySource; | 16 import com.google.dart.compiler.LibrarySource; |
| 17 import com.google.dart.compiler.MockArtifactProvider; | 17 import com.google.dart.compiler.MockArtifactProvider; |
| 18 import com.google.dart.compiler.PackageLibraryManager; | 18 import com.google.dart.compiler.PackageLibraryManager; |
| 19 import com.google.dart.compiler.Source; | 19 import com.google.dart.compiler.Source; |
| 20 import com.google.dart.compiler.UrlSource; | 20 import com.google.dart.compiler.UrlSource; |
| 21 import com.google.dart.compiler.ast.DartUnit; | 21 import com.google.dart.compiler.ast.DartUnit; |
| 22 import com.google.dart.compiler.ast.LibraryUnit; | 22 import com.google.dart.compiler.ast.LibraryUnit; |
| 23 import com.google.dart.compiler.common.ErrorExpectation; | 23 import com.google.dart.compiler.common.ErrorExpectation; |
| 24 import com.google.dart.compiler.resolver.ResolverErrorCode; | 24 import com.google.dart.compiler.resolver.ResolverErrorCode; |
| 25 import com.google.dart.compiler.resolver.TypeErrorCode; | 25 import com.google.dart.compiler.resolver.TypeErrorCode; |
| 26 import com.google.dart.compiler.type.TypeQuality; |
| 26 | 27 |
| 27 import static com.google.dart.compiler.DartCompiler.EXTENSION_DEPS; | 28 import static com.google.dart.compiler.DartCompiler.EXTENSION_DEPS; |
| 28 import static com.google.dart.compiler.DartCompiler.EXTENSION_TIMESTAMP; | 29 import static com.google.dart.compiler.DartCompiler.EXTENSION_TIMESTAMP; |
| 29 import static com.google.dart.compiler.common.ErrorExpectation.assertErrors; | 30 import static com.google.dart.compiler.common.ErrorExpectation.assertErrors; |
| 30 import static com.google.dart.compiler.common.ErrorExpectation.errEx; | 31 import static com.google.dart.compiler.common.ErrorExpectation.errEx; |
| 31 | 32 |
| 32 import junit.framework.AssertionFailedError; | 33 import junit.framework.AssertionFailedError; |
| 33 | 34 |
| 34 import java.io.IOException; | 35 import java.io.IOException; |
| 35 import java.io.Reader; | 36 import java.io.Reader; |
| (...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1345 " var b2 = query('DART_EDITOR_NO_SUCH_TYPE');", | 1346 " var b2 = query('DART_EDITOR_NO_SUCH_TYPE');", |
| 1346 " var b3 = query('body div');", | 1347 " var b3 = query('body div');", |
| 1347 "}", | 1348 "}", |
| 1348 "")); | 1349 "")); |
| 1349 // do compile, no errors expected | 1350 // do compile, no errors expected |
| 1350 compile(); | 1351 compile(); |
| 1351 assertErrors(errors); | 1352 assertErrors(errors); |
| 1352 // validate types | 1353 // validate types |
| 1353 DartUnit unit = units.get(APP); | 1354 DartUnit unit = units.get(APP); |
| 1354 assertNotNull(unit); | 1355 assertNotNull(unit); |
| 1355 assertInferredElementTypeString(unit, "v1", "AnchorElement"); | 1356 assertInferredElementTypeString(unit, "v1", "AnchorElement", TypeQuality.INF
ERRED); |
| 1356 assertInferredElementTypeString(unit, "v2", "AnchorElement"); | 1357 assertInferredElementTypeString(unit, "v2", "AnchorElement", TypeQuality.INF
ERRED); |
| 1357 assertInferredElementTypeString(unit, "v3", "BodyElement"); | 1358 assertInferredElementTypeString(unit, "v3", "BodyElement", TypeQuality.INFER
RED); |
| 1358 assertInferredElementTypeString(unit, "v4", "ButtonElement"); | 1359 assertInferredElementTypeString(unit, "v4", "ButtonElement", TypeQuality.INF
ERRED); |
| 1359 assertInferredElementTypeString(unit, "v5", "DivElement"); | 1360 assertInferredElementTypeString(unit, "v5", "DivElement", TypeQuality.INFERR
ED); |
| 1360 assertInferredElementTypeString(unit, "v6", "InputElement"); | 1361 assertInferredElementTypeString(unit, "v6", "InputElement", TypeQuality.INFE
RRED); |
| 1361 assertInferredElementTypeString(unit, "v7", "SelectElement"); | 1362 assertInferredElementTypeString(unit, "v7", "SelectElement", TypeQuality.INF
ERRED); |
| 1362 // invocation of method | 1363 // invocation of method |
| 1363 assertInferredElementTypeString(unit, "m1", "DivElement"); | 1364 assertInferredElementTypeString(unit, "m1", "DivElement", TypeQuality.INFERR
ED); |
| 1364 // bad cases, or unsupported now | 1365 // bad cases, or unsupported now |
| 1365 assertInferredElementTypeString(unit, "b1", "Element"); | 1366 assertInferredElementTypeString(unit, "b1", "Element", TypeQuality.INFERRED)
; |
| 1366 assertInferredElementTypeString(unit, "b2", "Element"); | 1367 assertInferredElementTypeString(unit, "b2", "Element", TypeQuality.INFERRED)
; |
| 1367 assertInferredElementTypeString(unit, "b3", "Element"); | 1368 assertInferredElementTypeString(unit, "b3", "Element", TypeQuality.INFERRED)
; |
| 1368 } | 1369 } |
| 1369 | 1370 |
| 1370 /** | 1371 /** |
| 1371 * Libraries "dart:io" and "dart:html" can not be used together in single appl
ication. | 1372 * Libraries "dart:io" and "dart:html" can not be used together in single appl
ication. |
| 1372 * <p> | 1373 * <p> |
| 1373 * http://code.google.com/p/dart/issues/detail?id=3839 | 1374 * http://code.google.com/p/dart/issues/detail?id=3839 |
| 1374 */ | 1375 */ |
| 1375 public void test_consoleWebMix() throws Exception { | 1376 public void test_consoleWebMix() throws Exception { |
| 1376 appSource.setContent( | 1377 appSource.setContent( |
| 1377 APP, | 1378 APP, |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1661 private void didWrite(String sourceName, String extension) { | 1662 private void didWrite(String sourceName, String extension) { |
| 1662 String spec = sourceName + "/" + extension; | 1663 String spec = sourceName + "/" + extension; |
| 1663 assertTrue("Expected write: " + spec, provider.writes.contains(spec)); | 1664 assertTrue("Expected write: " + spec, provider.writes.contains(spec)); |
| 1664 } | 1665 } |
| 1665 | 1666 |
| 1666 private void didNotWrite(String sourceName, String extension) { | 1667 private void didNotWrite(String sourceName, String extension) { |
| 1667 String spec = sourceName + "/" + extension; | 1668 String spec = sourceName + "/" + extension; |
| 1668 assertFalse("Didn't expect write: " + spec, provider.writes.contains(spec)); | 1669 assertFalse("Didn't expect write: " + spec, provider.writes.contains(spec)); |
| 1669 } | 1670 } |
| 1670 } | 1671 } |
| OLD | NEW |