blob: 07f2a23d60a7ca02e5efabc14f9a5e77849d90a1 [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.
// @dart = 2.9
/// @assertion Future<String> decodeStream(Stream<List<int>> byteStream)
/// @description Checks that this method decodes stream to Latin1 string
/// @author sgrekhov@unipro.ru
import "dart:async";
import "dart:convert";
import "../../../Utils/expect.dart";
Future check(String str) async {
Latin1Codec codec = new Latin1Codec();
List<int> data = codec.encode(str);
Stream<List<int>> byteStream = new Stream.fromIterable([data]);
codec.decodeStream(byteStream).then((String s) {
Expect.equals(str, s);
});
}
main() {
asyncStart();
Future.wait([
check(""),
check(r"Some string 12345 !#$%^&*-+=")
]).then(
(_) => asyncEnd()
);
}