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

Side by Side Diff: frog/tests/leg/src/TypeInferenceTest.dart

Issue 9592009: Reapply "Refactor constant part." (r4958) with fixes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add TODO. Created 8 years, 9 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
« no previous file with comments | « frog/tests/leg/src/TypeGuardUnuserTest.dart ('k') | tests/co19/co19-leg.status » ('j') | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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_ONE = @""" 7 final String TEST_ONE = @"""
8 sum(param0, param1) { 8 sum(param0, param1) {
9 var sum = 0; 9 var sum = 0;
10 for (var i = param0; i < param1; i += 1) sum = sum + i; 10 for (var i = param0; i < param1; i += 1) sum = sum + i;
(...skipping 30 matching lines...) Expand all
41 main(a) { 41 main(a) {
42 print(a[0]); 42 print(a[0]);
43 while (true) { 43 while (true) {
44 a[0] = a[1]; 44 a[0] = a[1];
45 } 45 }
46 } 46 }
47 """; 47 """;
48 48
49 main() { 49 main() {
50 String generated = compile(TEST_ONE, 'sum'); 50 String generated = compile(TEST_ONE, 'sum');
51 RegExp regexp = new RegExp("i = \\(?$anyIdentifier \\+ 1\\)?"); 51 RegExp regexp = new RegExp("i = \\(?$anyIdentifier \\+ \\(1\\)\\)?");
52 Expect.isTrue(regexp.hasMatch(generated)); 52 Expect.isTrue(regexp.hasMatch(generated));
53 53
54 regexp = new RegExp("sum = \\(?$anyIdentifier \\+ $anyIdentifier\\)?"); 54 regexp = new RegExp("sum = \\(?$anyIdentifier \\+ $anyIdentifier\\)?");
55 Expect.isTrue(regexp.hasMatch(generated)); 55 Expect.isTrue(regexp.hasMatch(generated));
56 56
57 regexp = const RegExp("typeof param0 !== 'number'"); 57 regexp = const RegExp("typeof param0 !== 'number'");
58 Expect.isTrue(regexp.hasMatch(generated)); 58 Expect.isTrue(regexp.hasMatch(generated));
59 59
60 regexp = const RegExp("typeof param1 !== 'number'"); 60 regexp = const RegExp("typeof param1 !== 'number'");
61 Expect.isTrue(regexp.hasMatch(generated)); 61 Expect.isTrue(regexp.hasMatch(generated));
(...skipping 18 matching lines...) Expand all
80 Expect.isTrue(regexp.hasMatch(generated)); 80 Expect.isTrue(regexp.hasMatch(generated));
81 Expect.isTrue(!generated.contains('index')); 81 Expect.isTrue(!generated.contains('index'));
82 Expect.isTrue(!generated.contains('indexSet')); 82 Expect.isTrue(!generated.contains('indexSet'));
83 83
84 generated = compile(TEST_FIVE, 'foo'); 84 generated = compile(TEST_FIVE, 'foo');
85 regexp = const RegExp('a.constructor !== Array'); 85 regexp = const RegExp('a.constructor !== Array');
86 Expect.isTrue(regexp.hasMatch(generated)); 86 Expect.isTrue(regexp.hasMatch(generated));
87 Expect.isTrue(!generated.contains('index')); 87 Expect.isTrue(!generated.contains('index'));
88 Expect.isTrue(!generated.contains('indexSet')); 88 Expect.isTrue(!generated.contains('indexSet'));
89 } 89 }
OLDNEW
« no previous file with comments | « frog/tests/leg/src/TypeGuardUnuserTest.dart ('k') | tests/co19/co19-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698