OLD | NEW |
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 library version_test; | 5 library version_test; |
6 | 6 |
7 import 'package:pub/src/transcript.dart'; | 7 import 'package:pub/src/transcript.dart'; |
8 import 'package:unittest/unittest.dart'; | 8 import 'package:test/test.dart'; |
9 | 9 |
10 import 'test_pub.dart'; | 10 import 'test_pub.dart'; |
11 | 11 |
12 main() { | 12 main() { |
13 initConfig(); | |
14 | |
15 test("discards from the middle once it reaches the maximum", () { | 13 test("discards from the middle once it reaches the maximum", () { |
16 var transcript = new Transcript<String>(4); | 14 var transcript = new Transcript<String>(4); |
17 forEachToString() { | 15 forEachToString() { |
18 var result = ""; | 16 var result = ""; |
19 transcript.forEach((entry) => result += entry, (n) => result += "[$n]"); | 17 transcript.forEach((entry) => result += entry, (n) => result += "[$n]"); |
20 return result; | 18 return result; |
21 } | 19 } |
22 | 20 |
23 expect(forEachToString(), equals("")); | 21 expect(forEachToString(), equals("")); |
24 transcript.add("a"); | 22 transcript.add("a"); |
(...skipping 27 matching lines...) Expand all Loading... |
52 expect(forEachToString(), equals("abc")); | 50 expect(forEachToString(), equals("abc")); |
53 transcript.add("d"); | 51 transcript.add("d"); |
54 expect(forEachToString(), equals("abcd")); | 52 expect(forEachToString(), equals("abcd")); |
55 transcript.add("e"); | 53 transcript.add("e"); |
56 expect(forEachToString(), equals("abcde")); | 54 expect(forEachToString(), equals("abcde")); |
57 transcript.add("f"); | 55 transcript.add("f"); |
58 expect(forEachToString(), equals("abcdef")); | 56 expect(forEachToString(), equals("abcdef")); |
59 }); | 57 }); |
60 | 58 |
61 } | 59 } |
OLD | NEW |