OLD | NEW |
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 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
8 import 'package:analyzer/dart/element/element.dart'; | 8 import 'package:analyzer/dart/element/element.dart'; |
9 import 'package:analyzer/error/error.dart'; | 9 import 'package:analyzer/error/error.dart'; |
10 import 'package:analyzer/src/error/codes.dart'; | 10 import 'package:analyzer/src/error/codes.dart'; |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 typedef A(int p1, String p2); | 366 typedef A(int p1, String p2); |
367 f(A a) { | 367 f(A a) { |
368 a(1, '2'); | 368 a(1, '2'); |
369 }'''); | 369 }'''); |
370 computeLibrarySourceErrors(source); | 370 computeLibrarySourceErrors(source); |
371 assertNoErrors(source); | 371 assertNoErrors(source); |
372 verify([source]); | 372 verify([source]); |
373 } | 373 } |
374 | 374 |
375 void test_assert_with_message_await() { | 375 void test_assert_with_message_await() { |
376 resetWithOptions(new AnalysisOptionsImpl()..enableAssertMessage = true); | |
377 Source source = addSource(''' | 376 Source source = addSource(''' |
378 import 'dart:async'; | 377 import 'dart:async'; |
379 f() async { | 378 f() async { |
380 assert(false, await g()); | 379 assert(false, await g()); |
381 } | 380 } |
382 Future<String> g() => null; | 381 Future<String> g() => null; |
383 '''); | 382 '''); |
384 computeLibrarySourceErrors(source); | 383 computeLibrarySourceErrors(source); |
385 assertNoErrors(source); | 384 assertNoErrors(source); |
386 verify([source]); | 385 verify([source]); |
387 } | 386 } |
388 | 387 |
389 void test_assert_with_message_dynamic() { | 388 void test_assert_with_message_dynamic() { |
390 resetWithOptions(new AnalysisOptionsImpl()..enableAssertMessage = true); | |
391 Source source = addSource(''' | 389 Source source = addSource(''' |
392 f() { | 390 f() { |
393 assert(false, g()); | 391 assert(false, g()); |
394 } | 392 } |
395 g() => null; | 393 g() => null; |
396 '''); | 394 '''); |
397 computeLibrarySourceErrors(source); | 395 computeLibrarySourceErrors(source); |
398 assertNoErrors(source); | 396 assertNoErrors(source); |
399 verify([source]); | 397 verify([source]); |
400 } | 398 } |
401 | 399 |
402 void test_assert_with_message_non_string() { | 400 void test_assert_with_message_non_string() { |
403 resetWithOptions(new AnalysisOptionsImpl()..enableAssertMessage = true); | |
404 Source source = addSource(''' | 401 Source source = addSource(''' |
405 f() { | 402 f() { |
406 assert(false, 3); | 403 assert(false, 3); |
407 } | 404 } |
408 '''); | 405 '''); |
409 computeLibrarySourceErrors(source); | 406 computeLibrarySourceErrors(source); |
410 assertNoErrors(source); | 407 assertNoErrors(source); |
411 verify([source]); | 408 verify([source]); |
412 } | 409 } |
413 | 410 |
414 void test_assert_with_message_null() { | 411 void test_assert_with_message_null() { |
415 resetWithOptions(new AnalysisOptionsImpl()..enableAssertMessage = true); | |
416 Source source = addSource(''' | 412 Source source = addSource(''' |
417 f() { | 413 f() { |
418 assert(false, null); | 414 assert(false, null); |
419 } | 415 } |
420 '''); | 416 '''); |
421 computeLibrarySourceErrors(source); | 417 computeLibrarySourceErrors(source); |
422 assertNoErrors(source); | 418 assertNoErrors(source); |
423 verify([source]); | 419 verify([source]); |
424 } | 420 } |
425 | 421 |
426 void test_assert_with_message_string() { | 422 void test_assert_with_message_string() { |
427 resetWithOptions(new AnalysisOptionsImpl()..enableAssertMessage = true); | |
428 Source source = addSource(''' | 423 Source source = addSource(''' |
429 f() { | 424 f() { |
430 assert(false, 'message'); | 425 assert(false, 'message'); |
431 } | 426 } |
432 '''); | 427 '''); |
433 computeLibrarySourceErrors(source); | 428 computeLibrarySourceErrors(source); |
434 assertNoErrors(source); | 429 assertNoErrors(source); |
435 verify([source]); | 430 verify([source]); |
436 } | 431 } |
437 | 432 |
438 void test_assert_with_message_suppresses_unused_var_hint() { | 433 void test_assert_with_message_suppresses_unused_var_hint() { |
439 resetWithOptions(new AnalysisOptionsImpl()..enableAssertMessage = true); | |
440 Source source = addSource(''' | 434 Source source = addSource(''' |
441 f() { | 435 f() { |
442 String message = 'msg'; | 436 String message = 'msg'; |
443 assert(true, message); | 437 assert(true, message); |
444 } | 438 } |
445 '''); | 439 '''); |
446 computeLibrarySourceErrors(source); | 440 computeLibrarySourceErrors(source); |
447 assertNoErrors(source); | 441 assertNoErrors(source); |
448 verify([source]); | 442 verify([source]); |
449 } | 443 } |
(...skipping 5811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6261 reset(); | 6255 reset(); |
6262 } | 6256 } |
6263 | 6257 |
6264 void _check_wrongNumberOfParametersForOperator1(String name) { | 6258 void _check_wrongNumberOfParametersForOperator1(String name) { |
6265 _check_wrongNumberOfParametersForOperator(name, "a"); | 6259 _check_wrongNumberOfParametersForOperator(name, "a"); |
6266 } | 6260 } |
6267 | 6261 |
6268 CompilationUnit _getResolvedLibraryUnit(Source source) => | 6262 CompilationUnit _getResolvedLibraryUnit(Source source) => |
6269 analysisContext.getResolvedCompilationUnit2(source, source); | 6263 analysisContext.getResolvedCompilationUnit2(source, source); |
6270 } | 6264 } |
OLD | NEW |