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

Side by Side Diff: tests/compiler/dart2js_extra/string_interpolation_opt1_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) 2014, the Dart project authors. Please see the AUTHORS file 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 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 "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 import 'dart:math'; 6 import 'dart:math';
7 7
8 // Test that String interpolation works in some optimized cases. 8 // Test that String interpolation works in some optimized cases.
9 9
10 bool get inscrutableFalse => new Random().nextDouble() > 2; 10 bool get inscrutableFalse => new Random().nextDouble() > 2;
11 11
12 returnsNullOrString(x) { 12 returnsNullOrString(x) {
13 if (inscrutableFalse) return 'hi'; 13 if (inscrutableFalse) return 'hi';
14 if (inscrutableFalse) return null; 14 if (inscrutableFalse) return null;
15 return x; 15 return x;
16 } 16 }
17 17
18 returnsNullOrInt(x) { 18 returnsNullOrInt(x) {
19 if (inscrutableFalse) return 123; 19 if (inscrutableFalse) return 123;
20 if (inscrutableFalse) return null; 20 if (inscrutableFalse) return null;
21 return x; 21 return x;
22 } 22 }
23 23
24 spoil(a) { 24 spoil(a) {
25 a[3] = 123; 25 a[3] = 123;
26 a[4] = 'ddd'; 26 a[4] = 'ddd';
27 } 27 }
28 28
29 void testString() { 29 void testString() {
30 var a = new List(100); // 'null' values in here are JavaScript undefined. 30 var a = new List(100); // 'null' values in here are JavaScript undefined.
31 spoil(a); 31 spoil(a);
32 var s = returnsNullOrString('hi'); 32 var s = returnsNullOrString('hi');
33 var x = a[2]; 33 var x = a[2];
34 if (x == null) { 34 if (x == null) {
35 s = returnsNullOrString(x); 35 s = returnsNullOrString(x);
36 } 36 }
37 37
38 Expect.equals('s: null', 's: $s'); 38 Expect.equals('s: null', 's: $s');
39 } 39 }
40 40
41 void testInt() { 41 void testInt() {
42 var a = new List(100); // 'null' values in here are JavaScript undefined. 42 var a = new List(100); // 'null' values in here are JavaScript undefined.
43 spoil(a); 43 spoil(a);
44 var s = returnsNullOrInt(123); 44 var s = returnsNullOrInt(123);
45 var x = a[2]; 45 var x = a[2];
46 if (x == null) { 46 if (x == null) {
47 s = returnsNullOrInt(x); 47 s = returnsNullOrInt(x);
48 } 48 }
49 49
50 Expect.equals('s: null', 's: $s'); 50 Expect.equals('s: null', 's: $s');
51 } 51 }
52 52
53 void main() { 53 void main() {
54 testInt(); 54 testInt();
55 testString(); 55 testString();
56 } 56 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698