Index: sdk/lib/_internal/pub/test/transcript_test.dart |
diff --git a/sdk/lib/_internal/pub/test/transcript_test.dart b/sdk/lib/_internal/pub/test/transcript_test.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..228dfcedb45d1ed9317fd61d0636529b3126997d |
--- /dev/null |
+++ b/sdk/lib/_internal/pub/test/transcript_test.dart |
@@ -0,0 +1,36 @@ |
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+ |
+library version_test; |
+ |
+import 'package:unittest/unittest.dart'; |
+import 'test_pub.dart'; |
+import '../lib/src/transcript.dart'; |
+ |
+main() { |
+ initConfig(); |
+ |
+ test('forEach', () { |
+ var transcript = new Transcript<String>(4); |
+ forEachToString() { |
+ var result = ""; |
+ transcript.forEach((entry) => result += entry, (n) => result += "[$n]"); |
+ return result; |
+ } |
+ |
+ expect(forEachToString(), equals("")); |
+ transcript.add("a"); |
+ expect(forEachToString(), equals("a")); |
+ transcript.add("b"); |
+ expect(forEachToString(), equals("ab")); |
+ transcript.add("c"); |
+ expect(forEachToString(), equals("abc")); |
+ transcript.add("d"); |
+ expect(forEachToString(), equals("abcd")); |
+ transcript.add("e"); |
+ expect(forEachToString(), equals("ab[1]de")); |
+ transcript.add("f"); |
+ expect(forEachToString(), equals("ab[2]ef")); |
+ }); |
+} |
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.
|