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