Skip to content

Commit

Permalink
std.file: Simplify readText example
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberShadow committed Jun 5, 2016
1 parent 9b11bc8 commit 79f5457
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions std/file.d
Original file line number Diff line number Diff line change
Expand Up @@ -412,14 +412,10 @@ S readText(S = string, R)(R name)
///
@safe unittest
{
import std.string;
write(deleteme, "abc\n"); // deleteme is the name of a temporary file
scope(exit)
{
assert(exists(deleteme));
remove(deleteme);
}
enforce(chomp(readText(deleteme)) == "abc");
write(deleteme, "abc"); // deleteme is the name of a temporary file
scope(exit) remove(deleteme);
string content = readText(deleteme);
enforce(content == "abc");
}

S readText(S = string, R)(auto ref R name)
Expand Down

0 comments on commit 79f5457

Please sign in to comment.