OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013, the Dart project authors. | 2 * Copyright (c) 2013, the Dart project authors. |
3 * | 3 * |
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 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 | 5 * in compliance with the License. You may obtain a copy of the License at |
6 * | 6 * |
7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
8 * | 8 * |
9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 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 | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
(...skipping 28 matching lines...) Expand all Loading... |
39 /** | 39 /** |
40 * The analysis context to pass in to all libraries created by the tests. | 40 * The analysis context to pass in to all libraries created by the tests. |
41 */ | 41 */ |
42 private AnalysisContextImpl analysisContext; | 42 private AnalysisContextImpl analysisContext; |
43 | 43 |
44 /** | 44 /** |
45 * The library used by the tests. | 45 * The library used by the tests. |
46 */ | 46 */ |
47 private Library library; | 47 private Library library; |
48 | 48 |
49 /* | |
50 * In order to keep the tests fast there are no tests for getAST(Source), | |
51 * getCompilationUnitSources(), getDefiningCompilationUnit() | |
52 */ | |
53 | |
54 @Override | 49 @Override |
55 public void setUp() { | 50 public void setUp() { |
56 sourceFactory = new SourceFactory(new FileUriResolver()); | 51 sourceFactory = new SourceFactory(new FileUriResolver()); |
57 analysisContext = new AnalysisContextImpl(); | 52 analysisContext = new AnalysisContextImpl(); |
58 analysisContext.setSourceFactory(sourceFactory); | 53 analysisContext.setSourceFactory(sourceFactory); |
59 errorListener = new GatheringErrorListener(); | 54 errorListener = new GatheringErrorListener(); |
60 library = createLibrary("/lib.dart"); | 55 library = createLibrary("/lib.dart"); |
61 } | 56 } |
62 | 57 |
| 58 /* |
| 59 * In order to keep the tests fast there are no tests for getAST(Source), |
| 60 * getCompilationUnitSources(), getDefiningCompilationUnit() |
| 61 */ |
| 62 |
63 public void test_getExplicitlyImportsCore() { | 63 public void test_getExplicitlyImportsCore() { |
64 assertFalse(library.getExplicitlyImportsCore()); | 64 assertFalse(library.getExplicitlyImportsCore()); |
65 errorListener.assertNoErrors(); | 65 errorListener.assertNoErrors(); |
66 } | 66 } |
67 | 67 |
68 public void test_getExports() { | 68 public void test_getExports() { |
69 assertLength(0, library.getExports()); | 69 assertLength(0, library.getExports()); |
70 errorListener.assertNoErrors(); | 70 errorListener.assertNoErrors(); |
71 } | 71 } |
72 | 72 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 assertSame(importLibrary, imports[0]); | 117 assertSame(importLibrary, imports[0]); |
118 errorListener.assertNoErrors(); | 118 errorListener.assertNoErrors(); |
119 } | 119 } |
120 | 120 |
121 public void test_setLibraryElement() { | 121 public void test_setLibraryElement() { |
122 LibraryElementImpl element = new LibraryElementImpl(analysisContext, library
Identifier("lib")); | 122 LibraryElementImpl element = new LibraryElementImpl(analysisContext, library
Identifier("lib")); |
123 library.setLibraryElement(element); | 123 library.setLibraryElement(element); |
124 assertSame(element, library.getLibraryElement()); | 124 assertSame(element, library.getLibraryElement()); |
125 } | 125 } |
126 | 126 |
| 127 @Override |
| 128 protected void tearDown() throws Exception { |
| 129 errorListener = null; |
| 130 sourceFactory = null; |
| 131 analysisContext = null; |
| 132 library = null; |
| 133 super.tearDown(); |
| 134 } |
| 135 |
127 private Library createLibrary(String definingCompilationUnitPath) { | 136 private Library createLibrary(String definingCompilationUnitPath) { |
128 return new Library(analysisContext, errorListener, new FileBasedSource( | 137 return new Library(analysisContext, errorListener, new FileBasedSource( |
129 createFile(definingCompilationUnitPath))); | 138 createFile(definingCompilationUnitPath))); |
130 } | 139 } |
131 } | 140 } |
OLD | NEW |