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

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

Issue 2997413002: Support --use-kernel in memory_compiler (Closed)
Patch Set: Created 3 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 'dart:async'; 5 import 'dart:async';
6 import 'package:async_helper/async_helper.dart'; 6 import 'package:async_helper/async_helper.dart';
7 import 'compiler_helper.dart'; 7 import 'compiler_helper.dart';
8 8
9 const String TEST_1 = r""" 9 const String TEST_1 = r"""
10 import 'dart:_foreign_helper'; 10 import 'dart:_foreign_helper';
11 main() { 11 main() {
12 JS('', '#.toString()', -5); 12 JS('', '#.toString()', -5);
13 // absent: "5.toString" 13 // absent: "5.toString"
14 // present: "(-5).toString" 14 // present: "(-5).toString"
15 } 15 }
16 """; 16 """;
17 17
18 main() { 18 main() {
19 Future check(String test) { 19 Future check(String test) {
20 Uri uri = new Uri(scheme: 'dart', path: 'test'); 20 Uri uri = new Uri(scheme: 'dart', path: 'test');
21 var compiler = compilerFor(test, uri, expectedErrors: 0); 21 var compiler = compilerFor(test, uri, expectedErrors: 0);
22 return compiler.run(uri).then((_) { 22 return compiler.run(uri).then((_) {
23 var element = findElement(compiler, 'main'); 23 MemberElement element = findElement(compiler, 'main');
24 var backend = compiler.backend; 24 var backend = compiler.backend;
25 String generated = backend.getGeneratedCode(element); 25 String generated = backend.getGeneratedCode(element);
26 checkerForAbsentPresent(test)(generated); 26 checkerForAbsentPresent(test)(generated);
27 }); 27 });
28 } 28 }
29 29
30 asyncTest(() => Future.wait([ 30 asyncTest(() => Future.wait([
31 check(TEST_1), 31 check(TEST_1),
32 ])); 32 ]));
33 } 33 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698