Chromium Code Reviews| OLD | NEW |
|---|---|
| (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('forEach', () { | |
| 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 } | |
|
nweiz
2013/12/11 06:53:03
Add a test where it doesn't discard entries as wel
Bob Nystrom
2013/12/11 17:40:01
Done.
| |
| OLD | NEW |