Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(850)

Unified Diff: packages/convert/test/accumulator_sink_test.dart

Issue 2990843002: Removed fixed dependencies (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « packages/convert/pubspec.yaml ('k') | packages/convert/test/byte_accumulator_sink_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/convert/test/accumulator_sink_test.dart
diff --git a/packages/convert/test/accumulator_sink_test.dart b/packages/convert/test/accumulator_sink_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..81fe1db7b8efe80af402635ecbb2d1755652ff97
--- /dev/null
+++ b/packages/convert/test/accumulator_sink_test.dart
@@ -0,0 +1,48 @@
+// Copyright (c) 2016, 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.
+
+import 'package:convert/convert.dart';
+import 'package:test/test.dart';
+
+void main() {
+ var sink;
+ setUp(() {
+ sink = new AccumulatorSink<int>();
+ });
+
+ test("provides access to events as they're added", () {
+ expect(sink.events, isEmpty);
+
+ sink.add(1);
+ expect(sink.events, equals([1]));
+
+ sink.add(2);
+ expect(sink.events, equals([1, 2]));
+
+ sink.add(3);
+ expect(sink.events, equals([1, 2, 3]));
+ });
+
+ test("clear() clears the events", () {
+ sink..add(1)..add(2)..add(3);
+ expect(sink.events, equals([1, 2, 3]));
+
+ sink.clear();
+ expect(sink.events, isEmpty);
+
+ sink..add(4)..add(5)..add(6);
+ expect(sink.events, equals([4, 5, 6]));
+ });
+
+ test("indicates whether the sink is closed", () {
+ expect(sink.isClosed, isFalse);
+ sink.close();
+ expect(sink.isClosed, isTrue);
+ });
+
+ test("doesn't allow add() to be called after close()", () {
+ sink.close();
+ expect(() => sink.add(1), throwsStateError);
+ });
+}
« no previous file with comments | « packages/convert/pubspec.yaml ('k') | packages/convert/test/byte_accumulator_sink_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698