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

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

Issue 2933753002: Run the sorter to reduce code churn (Closed)
Patch Set: Created 3 years, 6 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.generated.hint_code_test; 5 library analyzer.test.generated.hint_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'; 10 import 'package:analyzer/src/generated/parser.dart';
(...skipping 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after
1374 class A { 1374 class A {
1375 @immutable 1375 @immutable
1376 void m() {} 1376 void m() {}
1377 } 1377 }
1378 '''); 1378 ''');
1379 await computeAnalysisResult(source); 1379 await computeAnalysisResult(source);
1380 assertErrors(source, [HintCode.INVALID_IMMUTABLE_ANNOTATION]); 1380 assertErrors(source, [HintCode.INVALID_IMMUTABLE_ANNOTATION]);
1381 verify([source]); 1381 verify([source]);
1382 } 1382 }
1383 1383
1384 test_invalidRequiredParam_valid() async { 1384 test_invalidRequiredParam_on_named_parameter_with_default() async {
1385 Source source = addNamedSource( 1385 Source source = addNamedSource(
1386 '/lib1.dart', 1386 '/lib1.dart',
1387 r''' 1387 r'''
1388 import 'package:meta/meta.dart'; 1388 import 'package:meta/meta.dart';
1389 1389
1390 m1() => null; 1390 m({@required a = 1}) => null;
1391 m2(a) => null;
1392 m3([a]) => null;
1393 m4({a}) => null;
1394 m5({@required a}) => null;
1395 m6({a, @required b}) => null;
1396 ''');
1397 await computeAnalysisResult(source);
1398 assertNoErrors(source);
1399 verify([source]);
1400 }
1401
1402 test_invalidRequiredParam_on_required_parameter() async {
1403 Source source = addNamedSource(
1404 '/lib1.dart',
1405 r'''
1406 import 'package:meta/meta.dart';
1407
1408 m(@required a) => null;
1409 '''); 1391 ''');
1410 await computeAnalysisResult(source); 1392 await computeAnalysisResult(source);
1411 assertErrors(source, [HintCode.INVALID_REQUIRED_PARAM]); 1393 assertErrors(source, [HintCode.INVALID_REQUIRED_PARAM]);
1412 verify([source]); 1394 verify([source]);
1413 } 1395 }
1414 1396
1415 test_invalidRequiredParam_on_positional_parameter() async { 1397 test_invalidRequiredParam_on_positional_parameter() async {
1416 Source source = addNamedSource( 1398 Source source = addNamedSource(
1417 '/lib1.dart', 1399 '/lib1.dart',
1418 r''' 1400 r'''
(...skipping 12 matching lines...) Expand all
1431 r''' 1413 r'''
1432 import 'package:meta/meta.dart'; 1414 import 'package:meta/meta.dart';
1433 1415
1434 m([@required a = 1]) => null; 1416 m([@required a = 1]) => null;
1435 '''); 1417 ''');
1436 await computeAnalysisResult(source); 1418 await computeAnalysisResult(source);
1437 assertErrors(source, [HintCode.INVALID_REQUIRED_PARAM]); 1419 assertErrors(source, [HintCode.INVALID_REQUIRED_PARAM]);
1438 verify([source]); 1420 verify([source]);
1439 } 1421 }
1440 1422
1441 test_invalidRequiredParam_on_named_parameter_with_default() async { 1423 test_invalidRequiredParam_on_required_parameter() async {
1442 Source source = addNamedSource( 1424 Source source = addNamedSource(
1443 '/lib1.dart', 1425 '/lib1.dart',
1444 r''' 1426 r'''
1445 import 'package:meta/meta.dart'; 1427 import 'package:meta/meta.dart';
1446 1428
1447 m({@required a = 1}) => null; 1429 m(@required a) => null;
1448 '''); 1430 ''');
1449 await computeAnalysisResult(source); 1431 await computeAnalysisResult(source);
1450 assertErrors(source, [HintCode.INVALID_REQUIRED_PARAM]); 1432 assertErrors(source, [HintCode.INVALID_REQUIRED_PARAM]);
1451 verify([source]); 1433 verify([source]);
1452 } 1434 }
1453 1435
1436 test_invalidRequiredParam_valid() async {
1437 Source source = addNamedSource(
1438 '/lib1.dart',
1439 r'''
1440 import 'package:meta/meta.dart';
1441
1442 m1() => null;
1443 m2(a) => null;
1444 m3([a]) => null;
1445 m4({a}) => null;
1446 m5({@required a}) => null;
1447 m6({a, @required b}) => null;
1448 ''');
1449 await computeAnalysisResult(source);
1450 assertNoErrors(source);
1451 verify([source]);
1452 }
1453
1454 test_invalidUseOfProtectedMember_closure() async { 1454 test_invalidUseOfProtectedMember_closure() async {
1455 Source source = addNamedSource( 1455 Source source = addNamedSource(
1456 '/lib1.dart', 1456 '/lib1.dart',
1457 r''' 1457 r'''
1458 import 'package:meta/meta.dart'; 1458 import 'package:meta/meta.dart';
1459 1459
1460 class A { 1460 class A {
1461 @protected 1461 @protected
1462 int a() => 42; 1462 int a() => 42;
1463 } 1463 }
(...skipping 2872 matching lines...) Expand 10 before | Expand all | Expand 10 after
4336 n() { 4336 n() {
4337 var a = m(), b = m(); 4337 var a = m(), b = m();
4338 } 4338 }
4339 }'''); 4339 }''');
4340 await computeAnalysisResult(source); 4340 await computeAnalysisResult(source);
4341 assertErrors( 4341 assertErrors(
4342 source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]); 4342 source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]);
4343 verify([source]); 4343 verify([source]);
4344 } 4344 }
4345 } 4345 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/gn_test.dart ('k') | pkg/analyzer/test/generated/parser_fasta_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698