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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 provider.newFile( | 407 provider.newFile( |
408 part, | 408 part, |
409 ''' | 409 ''' |
410 part of lib; | 410 part of lib; |
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 expect(errors, hasLength(1)); |
418 // TODO(28522): Should cause an error for wrong library name. | 418 expect(errors[0].errorCode, |
419 expect(errors, hasLength(0)); | 419 ResolverErrorCode.MISSING_LIBRARY_DIRECTIVE_WITH_PART); |
420 } else { | |
421 expect(errors, hasLength(1)); | |
422 expect(errors[0].errorCode, | |
423 ResolverErrorCode.MISSING_LIBRARY_DIRECTIVE_WITH_PART); | |
424 } | |
425 } | 420 } |
426 | 421 |
427 test_analyze_resolveDirectives_error_partOfDifferentLibrary_byName() async { | 422 test_analyze_resolveDirectives_error_partOfDifferentLibrary_byName() async { |
428 var lib = _p('/test/lib.dart'); | 423 var lib = _p('/test/lib.dart'); |
429 var part = _p('/test/part.dart'); | 424 var part = _p('/test/part.dart'); |
430 provider.newFile( | 425 provider.newFile( |
431 lib, | 426 lib, |
432 ''' | 427 ''' |
433 library lib; | 428 library lib; |
434 part 'part.dart'; | 429 part 'part.dart'; |
(...skipping 1940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2375 * Return the [provider] specific path for the given Posix [path]. | 2370 * Return the [provider] specific path for the given Posix [path]. |
2376 */ | 2371 */ |
2377 String _p(String path) => provider.convertPath(path); | 2372 String _p(String path) => provider.convertPath(path); |
2378 | 2373 |
2379 static String _md5(String content) { | 2374 static String _md5(String content) { |
2380 return hex.encode(md5.convert(UTF8.encode(content)).bytes); | 2375 return hex.encode(md5.convert(UTF8.encode(content)).bytes); |
2381 } | 2376 } |
2382 } | 2377 } |
2383 | 2378 |
2384 class _SourceMock extends TypedMock implements Source {} | 2379 class _SourceMock extends TypedMock implements Source {} |
OLD | NEW |