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

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

Issue 2990223002: Reformat untouched files. (Closed)
Patch Set: Created 3 years, 4 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 }, 31 }, r'''
32 r'''
33 foo: 2 32 foo: 2
34 value=a data=second-a-data 33 value=a data=second-a-data
35 b 34 b
36 bar: 2 35 bar: 2
37 value=a data=third-a-data 36 value=a data=third-a-data
38 c 37 c
39 '''); 38 ''');
40 } 39 }
41 40
42 void testRecordFrequency() { 41 void testRecordFrequency() {
43 test((Stats stats) { 42 test((Stats stats) {
44 stats.recordFrequency('foo', 'a', 'first-a-data'); 43 stats.recordFrequency('foo', 'a', 'first-a-data');
45 stats.recordFrequency('foo', 'a', 'second-a-data'); 44 stats.recordFrequency('foo', 'a', 'second-a-data');
46 stats.recordFrequency('bar', 'b', 'first-b-data'); 45 stats.recordFrequency('bar', 'b', 'first-b-data');
47 stats.recordFrequency('foo', 'c'); 46 stats.recordFrequency('foo', 'c');
48 stats.recordFrequency('bar', 'b'); 47 stats.recordFrequency('bar', 'b');
49 }, 48 }, r'''
50 r'''
51 foo: 49 foo:
52 a: 2 50 a: 2
53 first-a-data 51 first-a-data
54 second-a-data 52 second-a-data
55 c: 1 53 c: 1
56 bar: 54 bar:
57 b: 2 55 b: 2
58 first-b-data 56 first-b-data
59 '''); 57 ''');
60 } 58 }
61 59
62 void testRecordCounter() { 60 void testRecordCounter() {
63 test((Stats stats) { 61 test((Stats stats) {
64 stats.recordCounter('foo', 'a'); 62 stats.recordCounter('foo', 'a');
65 stats.recordCounter('foo', 'a'); 63 stats.recordCounter('foo', 'a');
66 stats.recordCounter('foo', 'b'); 64 stats.recordCounter('foo', 'b');
67 stats.recordCounter('bar', 'c', 'first-c-data'); 65 stats.recordCounter('bar', 'c', 'first-c-data');
68 stats.recordCounter('bar', 'c', 'second-c-data'); 66 stats.recordCounter('bar', 'c', 'second-c-data');
69 stats.recordCounter('bar', 'd'); 67 stats.recordCounter('bar', 'd');
70 stats.recordCounter('bar', 'd'); 68 stats.recordCounter('bar', 'd');
71 stats.recordCounter('baz'); 69 stats.recordCounter('baz');
72 stats.recordCounter('baz'); 70 stats.recordCounter('baz');
73 }, 71 }, r'''
74 r'''
75 foo: 3 72 foo: 3
76 count=2 example=a 73 count=2 example=a
77 count=1 example=b 74 count=1 example=b
78 bar: 4 75 bar: 4
79 count=2 examples=2 76 count=2 examples=2
80 c: 77 c:
81 first-c-data 78 first-c-data
82 second-c-data 79 second-c-data
83 d 80 d
84 baz: 2 81 baz: 2
85 '''); 82 ''');
86 } 83 }
87 84
88 void test(f(Stats stats), expectedDump) { 85 void test(f(Stats stats), expectedDump) {
89 CollectingOutput output = new CollectingOutput(); 86 CollectingOutput output = new CollectingOutput();
90 Stats stats = new ActiveStats(new ConsolePrinter(output: output)); 87 Stats stats = new ActiveStats(new ConsolePrinter(output: output));
91 f(stats); 88 f(stats);
92 stats.dumpStats(); 89 stats.dumpStats();
93 print(output.toString()); 90 print(output.toString());
94 Expect.equals(expectedDump, output.toString()); 91 Expect.equals(expectedDump, output.toString());
95 } 92 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/sourcemaps/sourcemap_html_templates.dart ('k') | tests/compiler/dart2js/subtypeset_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698