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

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

Issue 2401463004: Issue 27515. Report DUPLICATE_PAR when the same library contains two part directives with the same … (Closed)
Patch Set: Created 4 years, 2 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/error/error.dart'; 7 import 'package:analyzer/error/error.dart';
8 import 'package:analyzer/src/error/codes.dart'; 8 import 'package:analyzer/src/error/codes.dart';
9 import 'package:analyzer/src/generated/engine.dart'; 9 import 'package:analyzer/src/generated/engine.dart';
10 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; 10 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode;
(...skipping 1941 matching lines...) Expand 10 before | Expand all | Expand 10 after
1952 Source source = addSource(r''' 1952 Source source = addSource(r'''
1953 f({a, b}) {} 1953 f({a, b}) {}
1954 main() { 1954 main() {
1955 f(a: 1, a: 2); 1955 f(a: 1, a: 2);
1956 }'''); 1956 }''');
1957 computeLibrarySourceErrors(source); 1957 computeLibrarySourceErrors(source);
1958 assertErrors(source, [CompileTimeErrorCode.DUPLICATE_NAMED_ARGUMENT]); 1958 assertErrors(source, [CompileTimeErrorCode.DUPLICATE_NAMED_ARGUMENT]);
1959 verify([source]); 1959 verify([source]);
1960 } 1960 }
1961 1961
1962 void test_duplicatePart() {
1963 addNamedSource('/part.dart', 'part of lib;');
1964 Source source = addSource(r'''
1965 library lib;
1966 part 'part.dart';
1967 part 'part.dart';
1968 ''');
1969 computeLibrarySourceErrors(source);
1970 assertErrors(source, [CompileTimeErrorCode.DUPLICATE_PART]);
1971 verify([source]);
1972 }
1973
1962 void test_exportInternalLibrary() { 1974 void test_exportInternalLibrary() {
1963 Source source = addSource("export 'dart:_interceptors';"); 1975 Source source = addSource("export 'dart:_interceptors';");
1964 computeLibrarySourceErrors(source); 1976 computeLibrarySourceErrors(source);
1965 assertErrors(source, [CompileTimeErrorCode.EXPORT_INTERNAL_LIBRARY]); 1977 assertErrors(source, [CompileTimeErrorCode.EXPORT_INTERNAL_LIBRARY]);
1966 verify([source]); 1978 verify([source]);
1967 } 1979 }
1968 1980
1969 void test_exportOfNonLibrary() { 1981 void test_exportOfNonLibrary() {
1970 Source source = addSource(r''' 1982 Source source = addSource(r'''
1971 library L; 1983 library L;
(...skipping 4427 matching lines...) Expand 10 before | Expand all | Expand 10 after
6399 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]); 6411 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]);
6400 verify([source]); 6412 verify([source]);
6401 reset(); 6413 reset();
6402 } 6414 }
6403 6415
6404 void _check_wrongNumberOfParametersForOperator1(String name) { 6416 void _check_wrongNumberOfParametersForOperator1(String name) {
6405 _check_wrongNumberOfParametersForOperator(name, ""); 6417 _check_wrongNumberOfParametersForOperator(name, "");
6406 _check_wrongNumberOfParametersForOperator(name, "a, b"); 6418 _check_wrongNumberOfParametersForOperator(name, "a, b");
6407 } 6419 }
6408 } 6420 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698