blob: 90a3162ffa96e719db2e05c8fbefd497317c8260 [file] [log] [blame]
* Copyright (c) 2017, 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.
* @assertion ClosableStringSink.fromStringSink(StringSink sink, void onClose())
* Creates a new instance combining a StringSink sink and a callback onClose
* which is invoked when the returned instance is closed.
* @description Checks that this constructor creates ClosableStringSink
* @author
import "dart:convert";
import "../../../Utils/expect.dart";
main() {
StringBuffer stringSink = new StringBuffer();
ClosableStringSink sink =
new ClosableStringSink.fromStringSink(stringSink, () {
Expect.equals("initial:12345", stringSink.toString());
Expect.equals("initial:12345:closed", stringSink.toString());