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

Side by Side Diff: tests/compiler/dart2js/is_inference_test.dart

Issue 10871071: - Change "static final" to "static const" in the tests/ directory. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 #import("compiler_helper.dart"); 5 #import("compiler_helper.dart");
6 6
7 final String TEST_IF = @""" 7 const String TEST_IF = @"""
8 test(param) { 8 test(param) {
9 if (param is int) { 9 if (param is int) {
10 param = param + 42; 10 param = param + 42;
11 } 11 }
12 return param + 53; 12 return param + 53;
13 } 13 }
14 """; 14 """;
15 15
16 final String TEST_IF_ELSE = @""" 16 const String TEST_IF_ELSE = @"""
17 test(param) { 17 test(param) {
18 if (param is int) { 18 if (param is int) {
19 param = param + 42; 19 param = param + 42;
20 } else { 20 } else {
21 param = param + 53; 21 param = param + 53;
22 } 22 }
23 return param + 53; 23 return param + 53;
24 } 24 }
25 """; 25 """;
26 26
27 final String TEST_IF_RETURN = @""" 27 const String TEST_IF_RETURN = @"""
28 test(param) { 28 test(param) {
29 if (param is int) { 29 if (param is int) {
30 return param + 42; 30 return param + 42;
31 } 31 }
32 return param + 53; 32 return param + 53;
33 } 33 }
34 """; 34 """;
35 35
36 final String TEST_IF_NOT_ELSE = @""" 36 const String TEST_IF_NOT_ELSE = @"""
37 test(param) { 37 test(param) {
38 if (param is !int) { 38 if (param is !int) {
39 param = param + 53; 39 param = param + 53;
40 } else { 40 } else {
41 param = param + 42; 41 param = param + 42;
42 } 42 }
43 return param; 43 return param;
44 } 44 }
45 """; 45 """;
46 46
47 final String TEST_IF_NOT_RETURN = @""" 47 const String TEST_IF_NOT_RETURN = @"""
48 test(param) { 48 test(param) {
49 if (param is !int) return param + 53; 49 if (param is !int) return param + 53;
50 return param + 42; 50 return param + 42;
51 } 51 }
52 """; 52 """;
53 53
54 final String TEST_IF_NOT_ELSE_RETURN = @""" 54 const String TEST_IF_NOT_ELSE_RETURN = @"""
55 test(param) { 55 test(param) {
56 if (param is !int) { 56 if (param is !int) {
57 return param + 53; 57 return param + 53;
58 } else { 58 } else {
59 param = param + 42; 59 param = param + 42;
60 } 60 }
61 return param; 61 return param;
62 } 62 }
63 """; 63 """;
64 64
65 compileAndTest(String code) { 65 compileAndTest(String code) {
66 String generated = compile(code, 'test'); 66 String generated = compile(code, 'test');
67 RegExp validAdd = 67 RegExp validAdd =
68 new RegExp("($anyIdentifier \\+ 42)|($anyIdentifier \\+= 42)"); 68 new RegExp("($anyIdentifier \\+ 42)|($anyIdentifier \\+= 42)");
69 RegExp invalidAdd = new RegExp("$anyIdentifier \\+ 53"); 69 RegExp invalidAdd = new RegExp("$anyIdentifier \\+ 53");
70 Expect.isTrue(validAdd.hasMatch(generated)); 70 Expect.isTrue(validAdd.hasMatch(generated));
71 Expect.isFalse(invalidAdd.hasMatch(generated)); 71 Expect.isFalse(invalidAdd.hasMatch(generated));
72 } 72 }
73 73
74 main() { 74 main() {
75 compileAndTest(TEST_IF); 75 compileAndTest(TEST_IF);
76 compileAndTest(TEST_IF_ELSE); 76 compileAndTest(TEST_IF_ELSE);
77 compileAndTest(TEST_IF_RETURN); 77 compileAndTest(TEST_IF_RETURN);
78 compileAndTest(TEST_IF_NOT_ELSE); 78 compileAndTest(TEST_IF_NOT_ELSE);
79 compileAndTest(TEST_IF_NOT_RETURN); 79 compileAndTest(TEST_IF_NOT_RETURN);
80 compileAndTest(TEST_IF_NOT_ELSE_RETURN); 80 compileAndTest(TEST_IF_NOT_ELSE_RETURN);
81 } 81 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/is_inference2_test.dart ('k') | tests/compiler/dart2js/literal_list_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698