mirror of
https://github.com/dlang/phobos.git
synced 2025-04-28 06:00:35 +03:00
Added unittest code to remove the testingByLine executable upon successful completion
This commit is contained in:
parent
9f98a3e070
commit
0c82bba5a0
1 changed files with 9 additions and 8 deletions
17
std/stdio.d
17
std/stdio.d
|
@ -949,6 +949,8 @@ to this file. */
|
|||
//printf("Entering test at line %d\n", __LINE__);
|
||||
scope(failure) printf("Failed test at line %d\n", __LINE__);
|
||||
std.file.write("testingByLine", "asd\ndef\nasdf");
|
||||
scope(success) std.file.remove("testingByLine");
|
||||
|
||||
auto witness = [ "asd", "def", "asdf" ];
|
||||
uint i;
|
||||
auto f = File("testingByLine");
|
||||
|
@ -956,7 +958,6 @@ to this file. */
|
|||
{
|
||||
f.close;
|
||||
assert(!f.isOpen);
|
||||
//std.file.remove("testingByLine");
|
||||
}
|
||||
foreach (line; f.byLine())
|
||||
{
|
||||
|
@ -1005,8 +1006,8 @@ to this file. */
|
|||
private:
|
||||
File file_;
|
||||
ubyte[] chunk_;
|
||||
|
||||
|
||||
|
||||
|
||||
public:
|
||||
this(File file, size_t size)
|
||||
in
|
||||
|
@ -1017,10 +1018,10 @@ to this file. */
|
|||
{
|
||||
file_ = file;
|
||||
chunk_ = new ubyte[](size);
|
||||
|
||||
|
||||
popFront();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// Range primitive operations.
|
||||
@property
|
||||
|
@ -1028,7 +1029,7 @@ to this file. */
|
|||
{
|
||||
return !file_.isOpen;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// Ditto
|
||||
@property
|
||||
|
@ -1036,13 +1037,13 @@ to this file. */
|
|||
{
|
||||
return chunk_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// Ditto
|
||||
void popFront()
|
||||
{
|
||||
enforce(!empty, "Cannot call popFront on empty range");
|
||||
|
||||
|
||||
chunk_ = file_.rawRead(chunk_);
|
||||
if (chunk_.length == 0)
|
||||
file_.detach();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue