| 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 static com.google.dart.compiler.DartCompiler.EXTENSION_DEPS; | 6 import static com.google.dart.compiler.DartCompiler.EXTENSION_DEPS; |
| 7 import static com.google.dart.compiler.DartCompiler.EXTENSION_TIMESTAMP; | 7 import static com.google.dart.compiler.DartCompiler.EXTENSION_TIMESTAMP; |
| 8 import static com.google.dart.compiler.common.ErrorExpectation.assertErrors; | 8 import static com.google.dart.compiler.common.ErrorExpectation.assertErrors; |
| 9 import static com.google.dart.compiler.common.ErrorExpectation.errEx; | 9 import static com.google.dart.compiler.common.ErrorExpectation.errEx; |
| 10 | 10 |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 URI uri = new URI("dart:noSuchSource"); | 664 URI uri = new URI("dart:noSuchSource"); |
| 665 Source source = new UrlSource(uri, new SystemLibraryManager()) { | 665 Source source = new UrlSource(uri, new SystemLibraryManager()) { |
| 666 @Override | 666 @Override |
| 667 public String getName() { | 667 public String getName() { |
| 668 return null; | 668 return null; |
| 669 } | 669 } |
| 670 }; | 670 }; |
| 671 // should not cause exception | 671 // should not cause exception |
| 672 assertFalse(source.exists()); | 672 assertFalse(source.exists()); |
| 673 } | 673 } |
| 674 /** |
| 675 * <p> |
| 676 * http://code.google.com/p/dart/issues/detail?id=3532 |
| 677 */ |
| 678 public void test_includeSameUnitTwice() throws Exception { |
| 679 appSource.setContent( |
| 680 "A.dart", |
| 681 makeCode( |
| 682 "// filler filler filler filler filler filler filler filler filler f
iller filler", |
| 683 "")); |
| 684 appSource.setContent( |
| 685 APP, |
| 686 makeCode( |
| 687 "// filler filler filler filler filler filler filler filler filler f
iller filler", |
| 688 "#library('application');", |
| 689 "#source('A.dart');", |
| 690 "#source('A.dart');", |
| 691 "")); |
| 692 // do compile, no errors expected |
| 693 compile(); |
| 694 assertErrors(errors, errEx(DartCompilerErrorCode.UNIT_WAS_ALREADY_INCLUDED,
4, 1, 18)); |
| 695 } |
| 674 | 696 |
| 675 /** | 697 /** |
| 676 * There was bug that we added <code>null</code> into {@link LibraryUnit#getIm
ports()}. Here trick | 698 * There was bug that we added <code>null</code> into {@link LibraryUnit#getIm
ports()}. Here trick |
| 677 * is that we reference "existing" {@link Source}, which can not be read. | 699 * is that we reference "existing" {@link Source}, which can not be read. |
| 678 * <p> | 700 * <p> |
| 679 * http://code.google.com/p/dart/issues/detail?id=2693 | 701 * http://code.google.com/p/dart/issues/detail?id=2693 |
| 680 */ | 702 */ |
| 681 public void test_ignoreNullLibrary() throws Exception { | 703 public void test_ignoreNullLibrary() throws Exception { |
| 682 appSource.setContent("canNotRead.dart", MemoryLibrarySource.IO_EXCEPTION_CON
TENT); | 704 appSource.setContent("canNotRead.dart", MemoryLibrarySource.IO_EXCEPTION_CON
TENT); |
| 683 appSource.setContent( | 705 appSource.setContent( |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 private void didWrite(String sourceName, String extension) { | 825 private void didWrite(String sourceName, String extension) { |
| 804 String spec = sourceName + "/" + extension; | 826 String spec = sourceName + "/" + extension; |
| 805 assertTrue("Expected write: " + spec, provider.writes.contains(spec)); | 827 assertTrue("Expected write: " + spec, provider.writes.contains(spec)); |
| 806 } | 828 } |
| 807 | 829 |
| 808 private void didNotWrite(String sourceName, String extension) { | 830 private void didNotWrite(String sourceName, String extension) { |
| 809 String spec = sourceName + "/" + extension; | 831 String spec = sourceName + "/" + extension; |
| 810 assertFalse("Didn't expect write: " + spec, provider.writes.contains(spec)); | 832 assertFalse("Didn't expect write: " + spec, provider.writes.contains(spec)); |
| 811 } | 833 } |
| 812 } | 834 } |
| OLD | NEW |