OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 | 4 |
5 library analyzer.test.generated.all_the_rest_test; | 5 library analyzer.test.generated.all_the_rest_test; |
6 | 6 |
7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
8 import 'package:analyzer/dart/ast/token.dart'; | 8 import 'package:analyzer/dart/ast/token.dart'; |
9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
10 import 'package:analyzer/dart/element/type.dart'; | 10 import 'package:analyzer/dart/element/type.dart'; |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 } | 148 } |
149 | 149 |
150 @reflectiveTest | 150 @reflectiveTest |
151 class DirectoryBasedDartSdkTest { | 151 class DirectoryBasedDartSdkTest { |
152 void fail_getDocFileFor() { | 152 void fail_getDocFileFor() { |
153 DirectoryBasedDartSdk sdk = _createDartSdk(); | 153 DirectoryBasedDartSdk sdk = _createDartSdk(); |
154 JavaFile docFile = sdk.getDocFileFor("html"); | 154 JavaFile docFile = sdk.getDocFileFor("html"); |
155 expect(docFile, isNotNull); | 155 expect(docFile, isNotNull); |
156 } | 156 } |
157 | 157 |
| 158 void test_analysisOptions_afterContextCreation() { |
| 159 DirectoryBasedDartSdk sdk = _createDartSdk(); |
| 160 sdk.context; |
| 161 expect(() { |
| 162 sdk.analysisOptions = new AnalysisOptionsImpl(); |
| 163 }, throwsStateError); |
| 164 } |
| 165 |
| 166 void test_analysisOptions_beforeContextCreation() { |
| 167 DirectoryBasedDartSdk sdk = _createDartSdk(); |
| 168 sdk.analysisOptions = new AnalysisOptionsImpl(); |
| 169 sdk.context; |
| 170 // cannot change "analysisOptions" in the context |
| 171 expect(() { |
| 172 sdk.context.analysisOptions = new AnalysisOptionsImpl(); |
| 173 }, throwsStateError); |
| 174 } |
| 175 |
158 void test_creation() { | 176 void test_creation() { |
159 DirectoryBasedDartSdk sdk = _createDartSdk(); | 177 DirectoryBasedDartSdk sdk = _createDartSdk(); |
160 expect(sdk, isNotNull); | 178 expect(sdk, isNotNull); |
161 } | 179 } |
162 | 180 |
163 void test_fromFile_invalid() { | 181 void test_fromFile_invalid() { |
164 DirectoryBasedDartSdk sdk = _createDartSdk(); | 182 DirectoryBasedDartSdk sdk = _createDartSdk(); |
165 expect( | 183 expect( |
166 sdk.fromFileUri(new JavaFile("/not/in/the/sdk.dart").toURI()), isNull); | 184 sdk.fromFileUri(new JavaFile("/not/in/the/sdk.dart").toURI()), isNull); |
167 } | 185 } |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 } | 273 } |
256 | 274 |
257 void test_getVmExecutable() { | 275 void test_getVmExecutable() { |
258 DirectoryBasedDartSdk sdk = _createDartSdk(); | 276 DirectoryBasedDartSdk sdk = _createDartSdk(); |
259 JavaFile executable = sdk.vmExecutable; | 277 JavaFile executable = sdk.vmExecutable; |
260 expect(executable, isNotNull); | 278 expect(executable, isNotNull); |
261 expect(executable.exists(), isTrue); | 279 expect(executable.exists(), isTrue); |
262 expect(executable.isExecutable(), isTrue); | 280 expect(executable.isExecutable(), isTrue); |
263 } | 281 } |
264 | 282 |
| 283 void test_useSummary_afterContextCreation() { |
| 284 DirectoryBasedDartSdk sdk = _createDartSdk(); |
| 285 sdk.context; |
| 286 expect(() { |
| 287 sdk.useSummary = true; |
| 288 }, throwsStateError); |
| 289 } |
| 290 |
| 291 void test_useSummary_beforeContextCreation() { |
| 292 DirectoryBasedDartSdk sdk = _createDartSdk(); |
| 293 sdk.useSummary = true; |
| 294 sdk.context; |
| 295 } |
| 296 |
265 DirectoryBasedDartSdk _createDartSdk() { | 297 DirectoryBasedDartSdk _createDartSdk() { |
266 JavaFile sdkDirectory = DirectoryBasedDartSdk.defaultSdkDirectory; | 298 JavaFile sdkDirectory = DirectoryBasedDartSdk.defaultSdkDirectory; |
267 expect(sdkDirectory, isNotNull, | 299 expect(sdkDirectory, isNotNull, |
268 reason: | 300 reason: |
269 "No SDK configured; set the property 'com.google.dart.sdk' on the co
mmand line"); | 301 "No SDK configured; set the property 'com.google.dart.sdk' on the co
mmand line"); |
270 return new DirectoryBasedDartSdk(sdkDirectory); | 302 return new DirectoryBasedDartSdk(sdkDirectory); |
271 } | 303 } |
272 } | 304 } |
273 | 305 |
274 @reflectiveTest | 306 @reflectiveTest |
(...skipping 3996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4271 expect(UriKind.fromEncoding(0x70), same(UriKind.PACKAGE_URI)); | 4303 expect(UriKind.fromEncoding(0x70), same(UriKind.PACKAGE_URI)); |
4272 expect(UriKind.fromEncoding(0x58), same(null)); | 4304 expect(UriKind.fromEncoding(0x58), same(null)); |
4273 } | 4305 } |
4274 | 4306 |
4275 void test_getEncoding() { | 4307 void test_getEncoding() { |
4276 expect(UriKind.DART_URI.encoding, 0x64); | 4308 expect(UriKind.DART_URI.encoding, 0x64); |
4277 expect(UriKind.FILE_URI.encoding, 0x66); | 4309 expect(UriKind.FILE_URI.encoding, 0x66); |
4278 expect(UriKind.PACKAGE_URI.encoding, 0x70); | 4310 expect(UriKind.PACKAGE_URI.encoding, 0x70); |
4279 } | 4311 } |
4280 } | 4312 } |
OLD | NEW |