Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Side by Side Diff: pkg/analyzer/test/src/dart/analysis/driver_test.dart

Issue 2640853005: Make Analyzer, VM and dart2js accept URI strings as part-of library identifier. (Closed)
Patch Set: Status fixes Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 expect(errors, hasLength(1)); 417 if (libResult.unit.element.context.analysisOptions.enableUriInPartOf) {
418 expect(errors[0].errorCode, 418 // TODO(28522): Should cause an error for wrong library name.
419 ResolverErrorCode.MISSING_LIBRARY_DIRECTIVE_WITH_PART); 419 expect(errors, hasLength(0));
420 } else {
421 expect(errors, hasLength(1));
422 expect(errors[0].errorCode,
423 ResolverErrorCode.MISSING_LIBRARY_DIRECTIVE_WITH_PART);
424 }
420 } 425 }
421 426
422 test_analyze_resolveDirectives_error_partOfDifferentLibrary_byName() async { 427 test_analyze_resolveDirectives_error_partOfDifferentLibrary_byName() async {
423 var lib = _p('/test/lib.dart'); 428 var lib = _p('/test/lib.dart');
424 var part = _p('/test/part.dart'); 429 var part = _p('/test/part.dart');
425 provider.newFile( 430 provider.newFile(
426 lib, 431 lib,
427 ''' 432 '''
428 library lib; 433 library lib;
429 part 'part.dart'; 434 part 'part.dart';
(...skipping 1940 matching lines...) Expand 10 before | Expand all | Expand 10 after
2370 * Return the [provider] specific path for the given Posix [path]. 2375 * Return the [provider] specific path for the given Posix [path].
2371 */ 2376 */
2372 String _p(String path) => provider.convertPath(path); 2377 String _p(String path) => provider.convertPath(path);
2373 2378
2374 static String _md5(String content) { 2379 static String _md5(String content) {
2375 return hex.encode(md5.convert(UTF8.encode(content)).bytes); 2380 return hex.encode(md5.convert(UTF8.encode(content)).bytes);
2376 } 2381 }
2377 } 2382 }
2378 2383
2379 class _SourceMock extends TypedMock implements Source {} 2384 class _SourceMock extends TypedMock implements Source {}
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/context/context_test.dart ('k') | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698