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

Side by Side Diff: pkg/analyzer/test/generated/compile_time_error_code_test.dart

Issue 1737693004: Update SOURCE_KIND when a missing source file appears (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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) 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.compile_time_error_code_test; 5 library analyzer.test.generated.compile_time_error_code_test;
6 6
7 import 'package:analyzer/src/generated/engine.dart' show ChangeSet;
7 import 'package:analyzer/src/generated/error.dart'; 8 import 'package:analyzer/src/generated/error.dart';
8 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; 9 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode;
9 import 'package:analyzer/src/generated/source_io.dart'; 10 import 'package:analyzer/src/generated/source_io.dart';
11 import 'package:analyzer/src/string_source.dart';
12 import 'package:unittest/unittest.dart' show expect;
10 13
11 import '../reflective_tests.dart'; 14 import '../reflective_tests.dart';
12 import '../utils.dart'; 15 import '../utils.dart';
13 import 'resolver_test.dart'; 16 import 'resolver_test.dart';
14 17
15 main() { 18 main() {
16 initializeTestEnvironment(); 19 initializeTestEnvironment();
17 runReflectiveTests(CompileTimeErrorCodeTest); 20 runReflectiveTests(CompileTimeErrorCodeTest);
18 } 21 }
19 22
(...skipping 6016 matching lines...) Expand 10 before | Expand all | Expand 10 after
6036 computeLibrarySourceErrors(source); 6039 computeLibrarySourceErrors(source);
6037 assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]); 6040 assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
6038 } 6041 }
6039 6042
6040 void test_uriDoesNotExist_import() { 6043 void test_uriDoesNotExist_import() {
6041 Source source = addSource("import 'unknown.dart';"); 6044 Source source = addSource("import 'unknown.dart';");
6042 computeLibrarySourceErrors(source); 6045 computeLibrarySourceErrors(source);
6043 assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]); 6046 assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
6044 } 6047 }
6045 6048
6049 void test_uriDoesNotExist_import_then_unused_import() {
6050 Source source = addSource("import 'target.dart';");
6051 computeLibrarySourceErrors(source);
6052 assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
6053
6054 Source target =
6055 analysisContext.sources.firstWhere((s) => s.fullName == "/target.dart");
6056 expect(target.modificationStamp, -1);
Brian Wilkerson 2016/02/26 15:07:32 I'm not 100% certain, but given that most of our t
6057 changeSource(target, "");
Brian Wilkerson 2016/02/26 15:07:32 When a file that didn't exist is created on disk,
skybrian 2016/02/26 18:09:01 I'm testing the case when the file hasn't been sav
Brian Wilkerson 2016/02/26 18:35:57 Ok. I just didn't realize that we had clients that
6058
6059 computeLibrarySourceErrors(source);
6060 assertErrors(source, [HintCode.UNUSED_IMPORT]);
6061 }
6062
6046 void test_uriDoesNotExist_part() { 6063 void test_uriDoesNotExist_part() {
6047 Source source = addSource(r''' 6064 Source source = addSource(r'''
6048 library lib; 6065 library lib;
6049 part 'unknown.dart';'''); 6066 part 'unknown.dart';''');
6050 computeLibrarySourceErrors(source); 6067 computeLibrarySourceErrors(source);
6051 assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]); 6068 assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
6052 } 6069 }
6053 6070
6054 void test_uriWithInterpolation_constant() { 6071 void test_uriWithInterpolation_constant() {
6055 Source source = addSource("import 'stuff_\$platform.dart';"); 6072 Source source = addSource("import 'stuff_\$platform.dart';");
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
6284 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]); 6301 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]);
6285 verify([source]); 6302 verify([source]);
6286 reset(); 6303 reset();
6287 } 6304 }
6288 6305
6289 void _check_wrongNumberOfParametersForOperator1(String name) { 6306 void _check_wrongNumberOfParametersForOperator1(String name) {
6290 _check_wrongNumberOfParametersForOperator(name, ""); 6307 _check_wrongNumberOfParametersForOperator(name, "");
6291 _check_wrongNumberOfParametersForOperator(name, "a, b"); 6308 _check_wrongNumberOfParametersForOperator(name, "a, b");
6292 } 6309 }
6293 } 6310 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698