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

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

Issue 3003363002: Report compile time errors when assert initializers fail. (Closed)
Patch Set: Created 3 years, 3 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
« no previous file with comments | « pkg/analyzer/test/generated/compile_time_error_code_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.non_error_resolver_test; 5 library analyzer.test.generated.non_error_resolver_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart';
(...skipping 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after
1449 library math; 1449 library math;
1450 const PI = 3.14;'''); 1450 const PI = 3.14;''');
1451 Source source = addSource(r''' 1451 Source source = addSource(r'''
1452 const C = #foo; 1452 const C = #foo;
1453 foo() {}'''); 1453 foo() {}''');
1454 await computeAnalysisResult(source); 1454 await computeAnalysisResult(source);
1455 assertNoErrors(source); 1455 assertNoErrors(source);
1456 verify([source]); 1456 verify([source]);
1457 } 1457 }
1458 1458
1459 test_constEvalThrowsException_assertInitializer_notConst() async {
1460 resetWith(
1461 options: new AnalysisOptionsImpl()..enableAssertInitializer = true);
1462 Source source = addSource(r'''
1463 class A {
1464 A(int p) : assert(p != 0);
1465 }
1466 var a = new A(0);
1467 ''');
1468 await computeAnalysisResult(source);
1469 assertNoErrors(source);
1470 verify([source]);
1471 }
1472
1473 test_constEvalThrowsException_assertInitializer_true() async {
1474 resetWith(
1475 options: new AnalysisOptionsImpl()..enableAssertInitializer = true);
1476 Source source = addSource(r'''
1477 class A {
1478 const A(int p) : assert(p != 0);
1479 }
1480 const a = const A(1);
1481 ''');
1482 await computeAnalysisResult(source);
1483 assertNoErrors(source);
1484 verify([source]);
1485 }
1486
1459 test_constEvalTypeBoolNumString_equal() async { 1487 test_constEvalTypeBoolNumString_equal() async {
1460 Source source = addSource(r''' 1488 Source source = addSource(r'''
1461 class A { 1489 class A {
1462 const A(); 1490 const A();
1463 } 1491 }
1464 class B { 1492 class B {
1465 final v; 1493 final v;
1466 const B.a1(bool p) : v = p == true; 1494 const B.a1(bool p) : v = p == true;
1467 const B.a2(bool p) : v = p == false; 1495 const B.a2(bool p) : v = p == false;
1468 const B.a3(bool p) : v = p == 0; 1496 const B.a3(bool p) : v = p == 0;
(...skipping 4872 matching lines...) Expand 10 before | Expand all | Expand 10 after
6341 await computeAnalysisResult(source); 6369 await computeAnalysisResult(source);
6342 assertNoErrors(source); 6370 assertNoErrors(source);
6343 verify([source]); 6371 verify([source]);
6344 reset(); 6372 reset();
6345 } 6373 }
6346 6374
6347 Future<Null> _check_wrongNumberOfParametersForOperator1(String name) async { 6375 Future<Null> _check_wrongNumberOfParametersForOperator1(String name) async {
6348 await _check_wrongNumberOfParametersForOperator(name, "a"); 6376 await _check_wrongNumberOfParametersForOperator(name, "a");
6349 } 6377 }
6350 } 6378 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/compile_time_error_code_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698