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

Side by Side Diff: tests/language/static_inline_test.dart

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 years, 8 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 6
7 // Test inlining of assignments in parameter passing. If [StringScanner.charAt] 7 // Test inlining of assignments in parameter passing. If [StringScanner.charAt]
8 // is inlined, the argument expresion [: ++byteOffset :] should not be 8 // is inlined, the argument expresion [: ++byteOffset :] should not be
9 // duplicated. 9 // duplicated.
10 10
11 class StringScanner { 11 class StringScanner {
12 static String string; 12 static String string;
13 int byteOffset = -1; 13 int byteOffset = -1;
14 14
15 int nextByte(foo) { 15 int nextByte(foo) {
16 if (foo) return -2; 16 if (foo) return -2;
17 return charAt(++byteOffset); 17 return charAt(++byteOffset);
18 } 18 }
19 19
20 static int charAt(index) 20 static int charAt(index) =>
21 => (string.length > index) ? string.codeUnitAt(index) : -1; 21 (string.length > index) ? string.codeUnitAt(index) : -1;
22 } 22 }
23 23
24 void main() { 24 void main() {
25 var scanner = new StringScanner(); 25 var scanner = new StringScanner();
26 StringScanner.string = 'az9'; 26 StringScanner.string = 'az9';
27 Expect.equals(0x61, scanner.nextByte(false)); // Expect a. 27 Expect.equals(0x61, scanner.nextByte(false)); // Expect a.
28 Expect.equals(0x7A, scanner.nextByte(false)); // Expect z. 28 Expect.equals(0x7A, scanner.nextByte(false)); // Expect z.
29 Expect.equals(0x39, scanner.nextByte(false)); // Expect 9. 29 Expect.equals(0x39, scanner.nextByte(false)); // Expect 9.
30 Expect.equals(-1, scanner.nextByte(false)); 30 Expect.equals(-1, scanner.nextByte(false));
31 } 31 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698