blob: c718ceebf8a88fd6fb593243c9dbd65b91df15ac [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 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);
}
var s = rf.toString();
Expect.isTrue(s is String);
Expect.runtimeIsType<String>(s);
asyncEnd();
rf.closeSync();
}).whenComplete(() {
file.deleteSync();
});
}