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; | |
6 | |
7 import 'package:pub/src/transcript.dart'; | 5 import 'package:pub/src/transcript.dart'; |
8 import 'package:test/test.dart'; | 6 import 'package:test/test.dart'; |
9 | 7 |
10 main() { | 8 main() { |
11 test("discards from the middle once it reaches the maximum", () { | 9 test("discards from the middle once it reaches the maximum", () { |
12 var transcript = new Transcript<String>(4); | 10 var transcript = new Transcript<String>(4); |
13 forEachToString() { | 11 forEachToString() { |
14 var result = ""; | 12 var result = ""; |
15 transcript.forEach((entry) => result += entry, (n) => result += "[$n]"); | 13 transcript.forEach((entry) => result += entry, (n) => result += "[$n]"); |
16 return result; | 14 return result; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 expect(forEachToString(), equals("abc")); | 46 expect(forEachToString(), equals("abc")); |
49 transcript.add("d"); | 47 transcript.add("d"); |
50 expect(forEachToString(), equals("abcd")); | 48 expect(forEachToString(), equals("abcd")); |
51 transcript.add("e"); | 49 transcript.add("e"); |
52 expect(forEachToString(), equals("abcde")); | 50 expect(forEachToString(), equals("abcde")); |
53 transcript.add("f"); | 51 transcript.add("f"); |
54 expect(forEachToString(), equals("abcdef")); | 52 expect(forEachToString(), equals("abcdef")); |
55 }); | 53 }); |
56 | 54 |
57 } | 55 } |
OLD | NEW |