Skip to content

Commit

Permalink
fix Issue 15517
Browse files Browse the repository at this point in the history
was already fixed but had no fixture

system unittest
  • Loading branch information
burner committed May 26, 2017
1 parent 86d5009 commit 46c9376
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions std/experimental/logger/core.d
Expand Up @@ -3144,3 +3144,39 @@ private void trustedStore(T)(ref shared T dst, ref T src) @trusted
tl.log("123456789"d);
assert(tl.msg == "123456789");
}

// Issue 15517
@system unittest
{
import std.stdio : File;
import std.string : indexOf;
import std.file : exists, remove;

auto oldShared = sharedLog;
scope(exit) sharedLog = oldShared;

auto ts = [ "Test log 1", "Test log 2", "Test log 3"];

string fn = "logfile.log";
sharedLog = new FileLogger(fn);
assert(exists(fn));

foreach (t; ts)
{
sharedLog.log(t);
}

auto f = File(fn);
auto l = f.byLine();
assert(!l.empty);
size_t idx;
foreach (it; l)
{
assert(it.indexOf(ts[idx]) != -1, it);
++idx;
}

assert(exists(fn));
remove(fn);
assert(!exists(fn));
}

0 comments on commit 46c9376

Please sign in to comment.