blob: 84880e5c695773c4f7bf7d2acc2a9d02de8b8d5f [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 String toString()
/// Returns a human-readable string for this RandomAccessFile instance.
///
/// @description Checks that method toString returns a human-readable string for
/// this RandomAccessFile instance.
/// @author ngl@unipro.ru
import "dart:async";
import "dart:io";
import "../../../Utils/expect.dart";
import "../file_utils.dart";
main() {
File file = getTempFileSync();
asyncStart();
Future<RandomAccessFile> raFile = file.open(mode: FileMode.write);
raFile.then((RandomAccessFile rf) {
Expect.isNotNull(rf);
for (int i = 0; i < 10; i++) {
rf.writeByteSync((i + 1) & 0xff);
}
String s = rf.toString();
Expect.isTrue(s is String);
asyncEnd();
rf.closeSync();
}).whenComplete(() {
file.deleteSync();
});
}