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

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: oops, fix the test 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/error.dart'; 7 import 'package:analyzer/src/generated/error.dart';
8 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; 8 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode;
9 import 'package:analyzer/src/generated/source_io.dart'; 9 import 'package:analyzer/src/generated/source_io.dart';
10 import 'package:unittest/unittest.dart' show expect;
10 11
11 import '../reflective_tests.dart'; 12 import '../reflective_tests.dart';
12 import '../utils.dart'; 13 import '../utils.dart';
13 import 'resolver_test.dart'; 14 import 'resolver_test.dart';
14 15
15 main() { 16 main() {
16 initializeTestEnvironment(); 17 initializeTestEnvironment();
17 runReflectiveTests(CompileTimeErrorCodeTest); 18 runReflectiveTests(CompileTimeErrorCodeTest);
18 } 19 }
19 20
(...skipping 6016 matching lines...) Expand 10 before | Expand all | Expand 10 after
6036 computeLibrarySourceErrors(source); 6037 computeLibrarySourceErrors(source);
6037 assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]); 6038 assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
6038 } 6039 }
6039 6040
6040 void test_uriDoesNotExist_import() { 6041 void test_uriDoesNotExist_import() {
6041 Source source = addSource("import 'unknown.dart';"); 6042 Source source = addSource("import 'unknown.dart';");
6042 computeLibrarySourceErrors(source); 6043 computeLibrarySourceErrors(source);
6043 assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]); 6044 assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
6044 } 6045 }
6045 6046
6047 void test_uriDoesNotExist_import_then_fixed() {
6048 Source source = addSource("import 'target.dart';");
6049 computeLibrarySourceErrors(source);
6050 assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
6051
6052 // Check that the file is represented as missing.
6053 Source target =
6054 analysisContext2.getSourcesWithFullName("/target.dart").first;
6055 expect(analysisContext2.getModificationStamp(target), -1);
6056
6057 // Add an overlay in the same way as AnalysisServer.
6058 analysisContext2
6059 ..setContents(target, "")
6060 ..handleContentsChanged(target, null, "", true);
6061
6062 // Make sure the error goes away.
6063 // TODO(skybrian) why isn't there an unused import hint?
6064 computeLibrarySourceErrors(source);
6065 assertErrors(source, [HintCode.UNUSED_IMPORT]);
6066 }
6067
6046 void test_uriDoesNotExist_part() { 6068 void test_uriDoesNotExist_part() {
6047 Source source = addSource(r''' 6069 Source source = addSource(r'''
6048 library lib; 6070 library lib;
6049 part 'unknown.dart';'''); 6071 part 'unknown.dart';''');
6050 computeLibrarySourceErrors(source); 6072 computeLibrarySourceErrors(source);
6051 assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]); 6073 assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
6052 } 6074 }
6053 6075
6054 void test_uriWithInterpolation_constant() { 6076 void test_uriWithInterpolation_constant() {
6055 Source source = addSource("import 'stuff_\$platform.dart';"); 6077 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]); 6306 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]);
6285 verify([source]); 6307 verify([source]);
6286 reset(); 6308 reset();
6287 } 6309 }
6288 6310
6289 void _check_wrongNumberOfParametersForOperator1(String name) { 6311 void _check_wrongNumberOfParametersForOperator1(String name) {
6290 _check_wrongNumberOfParametersForOperator(name, ""); 6312 _check_wrongNumberOfParametersForOperator(name, "");
6291 _check_wrongNumberOfParametersForOperator(name, "a, b"); 6313 _check_wrongNumberOfParametersForOperator(name, "a, b");
6292 } 6314 }
6293 } 6315 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/context/context.dart ('k') | pkg/analyzer/test/src/context/context_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698