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

Side by Side Diff: sdk/lib/_internal/pub_generated/test/transcript_test.dart

Issue 896623005: Use native async/await support in pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 5 years, 10 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library version_test;
6
7 import 'package:unittest/unittest.dart';
8 import 'test_pub.dart';
9 import '../lib/src/transcript.dart';
10
11 main() {
12 initConfig();
13
14 test("discards from the middle once it reaches the maximum", () {
15 var transcript = new Transcript<String>(4);
16 forEachToString() {
17 var result = "";
18 transcript.forEach((entry) => result += entry, (n) => result += "[$n]");
19 return result;
20 }
21
22 expect(forEachToString(), equals(""));
23 transcript.add("a");
24 expect(forEachToString(), equals("a"));
25 transcript.add("b");
26 expect(forEachToString(), equals("ab"));
27 transcript.add("c");
28 expect(forEachToString(), equals("abc"));
29 transcript.add("d");
30 expect(forEachToString(), equals("abcd"));
31 transcript.add("e");
32 expect(forEachToString(), equals("ab[1]de"));
33 transcript.add("f");
34 expect(forEachToString(), equals("ab[2]ef"));
35 });
36
37 test("does not discard if it doesn't reach the maximum", () {
38 var transcript = new Transcript<String>(40);
39 forEachToString() {
40 var result = "";
41 transcript.forEach((entry) => result += entry, (n) => result += "[$n]");
42 return result;
43 }
44
45 expect(forEachToString(), equals(""));
46 transcript.add("a");
47 expect(forEachToString(), equals("a"));
48 transcript.add("b");
49 expect(forEachToString(), equals("ab"));
50 transcript.add("c");
51 expect(forEachToString(), equals("abc"));
52 transcript.add("d");
53 expect(forEachToString(), equals("abcd"));
54 transcript.add("e");
55 expect(forEachToString(), equals("abcde"));
56 transcript.add("f");
57 expect(forEachToString(), equals("abcdef"));
58 });
59
60 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698