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

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

Issue 2054323002: Fix exit detection for try statements. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Add tests without a "finally" clause Created 4 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
« no previous file with comments | « pkg/analyzer/test/generated/all_the_rest_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) 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.non_hint_code_test; 5 library analyzer.test.generated.non_hint_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/source_io.dart'; 8 import 'package:analyzer/src/generated/source_io.dart';
9 9
10 import '../reflective_tests.dart'; 10 import '../reflective_tests.dart';
11 import '../utils.dart'; 11 import '../utils.dart';
12 import 'resolver_test_case.dart'; 12 import 'resolver_test_case.dart';
13 13
14 main() { 14 main() {
15 initializeTestEnvironment(); 15 initializeTestEnvironment();
16 runReflectiveTests(NonHintCodeTest); 16 runReflectiveTests(NonHintCodeTest);
17 } 17 }
18 18
19 @reflectiveTest 19 @reflectiveTest
20 class NonHintCodeTest extends ResolverTestCase { 20 class NonHintCodeTest extends ResolverTestCase {
21 void test_deadCode_afterTryCatch() {
22 Source source = addSource('''
23 main() {
24 try {
25 return f();
26 } catch (e) {
27 print(e);
28 }
29 print('not dead');
30 }
31 f() {
32 throw 'foo';
33 }
34 ''');
35 computeLibrarySourceErrors(source);
36 assertNoErrors(source);
37 verify([source]);
38 }
39
21 void test_deadCode_deadBlock_conditionalElse_debugConst() { 40 void test_deadCode_deadBlock_conditionalElse_debugConst() {
22 Source source = addSource(r''' 41 Source source = addSource(r'''
23 const bool DEBUG = true; 42 const bool DEBUG = true;
24 f() { 43 f() {
25 DEBUG ? 1 : 2; 44 DEBUG ? 1 : 2;
26 }'''); 45 }''');
27 computeLibrarySourceErrors(source); 46 computeLibrarySourceErrors(source);
28 assertNoErrors(source); 47 assertNoErrors(source);
29 verify([source]); 48 verify([source]);
30 } 49 }
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 1258
1240 void test_import_valid_outside_lib() { 1259 void test_import_valid_outside_lib() {
1241 cacheSource("/myproj/pubspec.yaml", ""); 1260 cacheSource("/myproj/pubspec.yaml", "");
1242 cacheSource("/myproj/web/other.dart", ""); 1261 cacheSource("/myproj/web/other.dart", "");
1243 Source source = 1262 Source source =
1244 addNamedSource("/myproj/lib2/test.dart", "import '../web/other.dart';"); 1263 addNamedSource("/myproj/lib2/test.dart", "import '../web/other.dart';");
1245 computeLibrarySourceErrors(source); 1264 computeLibrarySourceErrors(source);
1246 assertNoErrors(source); 1265 assertNoErrors(source);
1247 } 1266 }
1248 } 1267 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/all_the_rest_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698