Skip to content

Commit

Permalink
add original test case of issue 18789
Browse files Browse the repository at this point in the history
Fixes issue 18789.
  • Loading branch information
aG0aep6G committed Sep 21, 2020
1 parent 4b416af commit f2903b7
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions std/stdio.d
Expand Up @@ -3710,6 +3710,26 @@ void main()
assert(std.file.readText!string(deleteme).stripLeft("\uFEFF") ==
text(strs));
}
@safe unittest // https://issues.dlang.org/show_bug.cgi?id=18789
{
static import std.file;
auto deleteme = testFilename();
scope(exit) std.file.remove(deleteme);
// converting to char
{
auto f = File(deleteme, "w");
f.writeln("\U0001F608"w); // UTFException
}
// converting to wchar_t
{
auto f = File(deleteme, "w,ccs=UTF16LE");
// from char
f.writeln("ö"); // writes garbage
f.writeln("\U0001F608"); // ditto
// from wchar
f.writeln("\U0001F608"w); // leads to ErrnoException
}
}

@safe unittest
{
Expand Down

0 comments on commit f2903b7

Please sign in to comment.