OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.driver; | 5 library analyzer.test.driver; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:convert'; | 8 import 'dart:convert'; |
9 | 9 |
10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 '''); | 411 '''); |
412 | 412 |
413 driver.addFile(lib); | 413 driver.addFile(lib); |
414 | 414 |
415 AnalysisResult libResult = await driver.getResult(lib); | 415 AnalysisResult libResult = await driver.getResult(lib); |
416 List<AnalysisError> errors = libResult.errors; | 416 List<AnalysisError> errors = libResult.errors; |
417 if (libResult.unit.element.context.analysisOptions.enableUriInPartOf) { | 417 if (libResult.unit.element.context.analysisOptions.enableUriInPartOf) { |
418 // TODO(28522): Should cause an error for wrong library name. | 418 // TODO(28522): Should cause an error for wrong library name. |
419 expect(errors, hasLength(0)); | 419 expect(errors, hasLength(0)); |
420 } else { | 420 } else { |
421 expect(errors, hasLength(1)); | 421 expect(errors, hasLength(1)); |
422 expect(errors[0].errorCode, | 422 expect(errors[0].errorCode, |
423 ResolverErrorCode.MISSING_LIBRARY_DIRECTIVE_WITH_PART); | 423 ResolverErrorCode.MISSING_LIBRARY_DIRECTIVE_WITH_PART); |
424 } | 424 } |
425 } | 425 } |
426 | 426 |
427 test_analyze_resolveDirectives_error_partOfDifferentLibrary_byName() async { | 427 test_analyze_resolveDirectives_error_partOfDifferentLibrary_byName() async { |
428 var lib = _p('/test/lib.dart'); | 428 var lib = _p('/test/lib.dart'); |
429 var part = _p('/test/part.dart'); | 429 var part = _p('/test/part.dart'); |
430 provider.newFile( | 430 provider.newFile( |
431 lib, | 431 lib, |
432 ''' | 432 ''' |
433 library lib; | 433 library lib; |
(...skipping 1941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2375 * Return the [provider] specific path for the given Posix [path]. | 2375 * Return the [provider] specific path for the given Posix [path]. |
2376 */ | 2376 */ |
2377 String _p(String path) => provider.convertPath(path); | 2377 String _p(String path) => provider.convertPath(path); |
2378 | 2378 |
2379 static String _md5(String content) { | 2379 static String _md5(String content) { |
2380 return hex.encode(md5.convert(UTF8.encode(content)).bytes); | 2380 return hex.encode(md5.convert(UTF8.encode(content)).bytes); |
2381 } | 2381 } |
2382 } | 2382 } |
2383 | 2383 |
2384 class _SourceMock extends TypedMock implements Source {} | 2384 class _SourceMock extends TypedMock implements Source {} |
OLD | NEW |