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

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

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

Powered by Google App Engine
This is Rietveld 408576698