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

Side by Side Diff: tests/compiler/dart2js/stats_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 'package:compiler/src/helpers/helpers.dart'; 6 import 'package:compiler/src/helpers/helpers.dart';
7 7
8 class CollectingOutput implements StatsOutput { 8 class CollectingOutput implements StatsOutput {
9 final StringBuffer sb = new StringBuffer(); 9 final StringBuffer sb = new StringBuffer();
10 10
(...skipping 10 matching lines...) Expand all
21 testRecordCounter(); 21 testRecordCounter();
22 } 22 }
23 23
24 void testRecordElement() { 24 void testRecordElement() {
25 test((Stats stats) { 25 test((Stats stats) {
26 stats.recordElement('foo', 'a', data: 'first-a-data'); 26 stats.recordElement('foo', 'a', data: 'first-a-data');
27 stats.recordElement('foo', 'a', data: 'second-a-data'); 27 stats.recordElement('foo', 'a', data: 'second-a-data');
28 stats.recordElement('foo', 'b'); 28 stats.recordElement('foo', 'b');
29 stats.recordElement('bar', 'a', data: 'third-a-data'); 29 stats.recordElement('bar', 'a', data: 'third-a-data');
30 stats.recordElement('bar', 'c'); 30 stats.recordElement('bar', 'c');
31 }, r''' 31 },
32 r'''
32 foo: 2 33 foo: 2
33 value=a data=second-a-data 34 value=a data=second-a-data
34 b 35 b
35 bar: 2 36 bar: 2
36 value=a data=third-a-data 37 value=a data=third-a-data
37 c 38 c
38 '''); 39 ''');
39 } 40 }
40 41
41 void testRecordFrequency() { 42 void testRecordFrequency() {
42 test((Stats stats) { 43 test((Stats stats) {
43 stats.recordFrequency('foo', 'a', 'first-a-data'); 44 stats.recordFrequency('foo', 'a', 'first-a-data');
44 stats.recordFrequency('foo', 'a', 'second-a-data'); 45 stats.recordFrequency('foo', 'a', 'second-a-data');
45 stats.recordFrequency('bar', 'b', 'first-b-data'); 46 stats.recordFrequency('bar', 'b', 'first-b-data');
46 stats.recordFrequency('foo', 'c'); 47 stats.recordFrequency('foo', 'c');
47 stats.recordFrequency('bar', 'b'); 48 stats.recordFrequency('bar', 'b');
48 }, r''' 49 },
50 r'''
49 foo: 51 foo:
50 a: 2 52 a: 2
51 first-a-data 53 first-a-data
52 second-a-data 54 second-a-data
53 c: 1 55 c: 1
54 bar: 56 bar:
55 b: 2 57 b: 2
56 first-b-data 58 first-b-data
57 '''); 59 ''');
58 } 60 }
59 61
60 void testRecordCounter() { 62 void testRecordCounter() {
61 test((Stats stats) { 63 test((Stats stats) {
62 stats.recordCounter('foo', 'a'); 64 stats.recordCounter('foo', 'a');
63 stats.recordCounter('foo', 'a'); 65 stats.recordCounter('foo', 'a');
64 stats.recordCounter('foo', 'b'); 66 stats.recordCounter('foo', 'b');
65 stats.recordCounter('bar', 'c', 'first-c-data'); 67 stats.recordCounter('bar', 'c', 'first-c-data');
66 stats.recordCounter('bar', 'c', 'second-c-data'); 68 stats.recordCounter('bar', 'c', 'second-c-data');
67 stats.recordCounter('bar', 'd'); 69 stats.recordCounter('bar', 'd');
68 stats.recordCounter('bar', 'd'); 70 stats.recordCounter('bar', 'd');
69 stats.recordCounter('baz'); 71 stats.recordCounter('baz');
70 stats.recordCounter('baz'); 72 stats.recordCounter('baz');
71 }, r''' 73 },
74 r'''
72 foo: 3 75 foo: 3
73 count=2 example=a 76 count=2 example=a
74 count=1 example=b 77 count=1 example=b
75 bar: 4 78 bar: 4
76 count=2 examples=2 79 count=2 examples=2
77 c: 80 c:
78 first-c-data 81 first-c-data
79 second-c-data 82 second-c-data
80 d 83 d
81 baz: 2 84 baz: 2
82 '''); 85 ''');
83 } 86 }
84 87
85 void test(f(Stats stats), expectedDump) { 88 void test(f(Stats stats), expectedDump) {
86 CollectingOutput output = new CollectingOutput(); 89 CollectingOutput output = new CollectingOutput();
87 Stats stats = new ActiveStats(new ConsolePrinter(output: output)); 90 Stats stats = new ActiveStats(new ConsolePrinter(output: output));
88 f(stats); 91 f(stats);
89 stats.dumpStats(); 92 stats.dumpStats();
90 print(output.toString()); 93 print(output.toString());
91 Expect.equals(expectedDump, output.toString()); 94 Expect.equals(expectedDump, output.toString());
92 } 95 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/static_closure_test.dart ('k') | tests/compiler/dart2js/string_add_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698