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

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

Issue 682243004: Redo "Constant fold charCodeAt via constant system" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix analysis warning Created 6 years, 1 month 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4 // Test constant folding on numbers.
5
6 import 'dart:async';
7 import 'package:expect/expect.dart';
8 import 'package:async_helper/async_helper.dart';
9 import 'compiler_helper.dart';
10
11 const String TEST_1 = """
12 foo() {
13 var a = 'Hello';
14 var b = 0;
15 return a.codeUnitAt(b);
16 }
17 """;
18
19 // No folding of index type error.
20 const String TEST_2 = """
21 foo() {
22 var a = 'Hello';
23 var b = 1.5;
24 return a.codeUnitAt(b);
25 }
26 """;
27
28 // No folding of index range error.
29 const String TEST_3 = """
30 foo() {
31 var a = 'Hello';
32 var b = 55;
33 return a.codeUnitAt(b);
34 }
35 """;
36
37 main() {
38 asyncTest(() => Future.wait([
39 compileAndMatch(TEST_1, 'foo', new RegExp(r'return 72')),
40 compileAndDoNotMatch(TEST_1, 'foo', new RegExp(r'Hello')),
41
42 compileAndMatch(TEST_2, 'foo', new RegExp(r'Hello')),
43 compileAndMatch(TEST_3, 'foo', new RegExp(r'Hello')),
44 ]));
45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698