OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2013, the Dart project authors. |
| 3 * |
| 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
| 5 * in compliance with the License. You may obtain a copy of the License at |
| 6 * |
| 7 * http://www.eclipse.org/legal/epl-v10.html |
| 8 * |
| 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
| 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
| 11 * or implied. See the License for the specific language governing permissions a
nd limitations under |
| 12 * the License. |
| 13 */ |
| 14 package com.google.dart.engine.resolver; |
| 15 |
| 16 import com.google.dart.engine.error.CompileTimeErrorCode; |
| 17 import com.google.dart.engine.error.PubSuggestionCode; |
| 18 import com.google.dart.engine.source.Source; |
| 19 |
| 20 public class PubSuggestionCodeTest extends ResolverTestCase { |
| 21 |
| 22 public void test_import_packageWithDotDot() throws Exception { |
| 23 Source source = addSource(createSource(// |
| 24 "import 'package:somepackage/../other.dart';")); |
| 25 resolve(source); |
| 26 assertErrors( |
| 27 CompileTimeErrorCode.URI_DOES_NOT_EXIST, |
| 28 PubSuggestionCode.PACKAGE_IMPORT_CONTAINS_DOT_DOT); |
| 29 } |
| 30 |
| 31 public void test_import_referenceIntoLibDirectory() throws Exception { |
| 32 Source source = addSource(createSource(// |
| 33 "import '../lib/other.dart';")); |
| 34 resolve(source); |
| 35 assertErrors( |
| 36 CompileTimeErrorCode.URI_DOES_NOT_EXIST, |
| 37 PubSuggestionCode.FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE); |
| 38 } |
| 39 |
| 40 public void test_import_referenceOutOfLibDirectory() throws Exception { |
| 41 Source source = addSource("lib/test.dart", createSource(// |
| 42 "import '../web/other.dart';")); |
| 43 resolve(source); |
| 44 assertErrors( |
| 45 CompileTimeErrorCode.URI_DOES_NOT_EXIST, |
| 46 PubSuggestionCode.FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE); |
| 47 } |
| 48 |
| 49 public void test_import_valid() throws Exception { |
| 50 Source source = addSource("lib2/test.dart", createSource(// |
| 51 "import '../web/other.dart';")); |
| 52 resolve(source); |
| 53 assertErrors(CompileTimeErrorCode.URI_DOES_NOT_EXIST); |
| 54 } |
| 55 } |
OLD | NEW |