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

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

Issue 2345083003: dart2js: run dartfmt on tests (Closed)
Patch Set: revert another multipart test Created 4 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:_foreign_helper' show JS; 5 import 'dart:_foreign_helper' show JS;
6 import "package:expect/expect.dart"; 6 import "package:expect/expect.dart";
7 7
8 // Negative constant numbers must be generated as negation, not just a literal 8 // Negative constant numbers must be generated as negation, not just a literal
9 // with a sign, i.e. 9 // with a sign, i.e.
10 // 10 //
11 // (-5).toString() 11 // (-5).toString()
12 // 12 //
13 // not 13 // not
14 // 14 //
15 // -5 .toString() 15 // -5 .toString()
16 // 16 //
17 // The unparethesized version is `-(5 .toString())`, which creates the string 17 // The unparethesized version is `-(5 .toString())`, which creates the string
18 // `"5"`, then converts it to a number for negation, giving a number result 18 // `"5"`, then converts it to a number for negation, giving a number result
19 // instead of a string result. 19 // instead of a string result.
20 20
21 @NoInline() 21 @NoInline()
22 checkString(r) { 22 checkString(r) {
23 Expect.isTrue(r is String, 23 Expect.isTrue(
24 'Expected string, found ${r} of type ${r.runtimeType}'); 24 r is String, 'Expected string, found ${r} of type ${r.runtimeType}');
25 } 25 }
26 26
27 test1() { 27 test1() {
28 checkString(JS('', '#.toString()', -5)); 28 checkString(JS('', '#.toString()', -5));
29 } 29 }
30 30
31 test2() { 31 test2() {
32 checkString(JS('', '#.toString()', -1.5)); 32 checkString(JS('', '#.toString()', -1.5));
33 } 33 }
34 34
35 test3() { 35 test3() {
36 checkString(JS('', '#.toString()', -0.0)); 36 checkString(JS('', '#.toString()', -0.0));
37 } 37 }
38 38
39
40 main() { 39 main() {
41 test1(); 40 test1();
42 test2(); 41 test2();
43 test3(); 42 test3();
44 } 43 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js_native/js_const_test.dart ('k') | tests/compiler/dart2js_native/jsobject_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698