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