| // 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 void writeCharCode(int charCode) |
| /// Writes the character of [charCode]. |
| /// This method is equivalent to [write(new String.fromCharCode(charCode))]. |
| /// @description Checks that correct char code is written for maximum possible |
| /// value in range (1114111). |
| /// @author iarkh@unipro.ru |
| |
| import "../../../Utils/expect.dart"; |
| import "dart:async"; |
| import "dart:io"; |
| |
| int called = 0; |
| |
| class MyStreamConsumer extends StreamConsumer<List<int>> { |
| Future addStream(Stream<List<int>> stream) { |
| stream.toList().then((x) { |
| Expect.listEquals(x[0], x[1]); |
| called++; |
| }); |
| return new Future(() {}); |
| } |
| |
| Future close() { return new Future(() {}); } |
| } |
| |
| test() async { |
| StreamConsumer<List<int>> consumer = new MyStreamConsumer(); |
| IOSink sink = new IOSink(consumer); |
| sink.writeCharCode(1114111); |
| sink.write(new String.fromCharCode(1114111)); |
| await sink.close(); |
| Expect.equals(1, called); |
| asyncEnd(); |
| } |
| |
| main() { |
| asyncStart(); |
| test(); |
| } |