Merge pull request #188 from Herringway/linebreak-tests
fix windows/mac linebreaks merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
This commit is contained in:
commit
206995836d
|
@ -319,3 +319,28 @@ struct Dumper(Range)
|
|||
//account for newline at end
|
||||
assert(stream.data[$-4..$-1] != "...");
|
||||
}
|
||||
// Windows, macOS line breaks
|
||||
@safe unittest
|
||||
{
|
||||
auto node = Node(0);
|
||||
{
|
||||
auto stream = new Appender!string();
|
||||
auto dumper = dumper(stream);
|
||||
dumper.explicitEnd = true;
|
||||
dumper.explicitStart = true;
|
||||
dumper.YAMLVersion = null;
|
||||
dumper.lineBreak = LineBreak.Windows;
|
||||
dumper.dump(node);
|
||||
assert(stream.data == "--- 0\r\n...\r\n");
|
||||
}
|
||||
{
|
||||
auto stream = new Appender!string();
|
||||
auto dumper = dumper(stream);
|
||||
dumper.explicitEnd = true;
|
||||
dumper.explicitStart = true;
|
||||
dumper.YAMLVersion = null;
|
||||
dumper.lineBreak = LineBreak.Macintosh;
|
||||
dumper.dump(node);
|
||||
assert(stream.data == "--- 0\r...\r");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ string lineBreak(in LineBreak b) pure @safe nothrow
|
|||
final switch(b)
|
||||
{
|
||||
case LineBreak.Unix: return "\n";
|
||||
case LineBreak.Windows: return "\r";
|
||||
case LineBreak.Macintosh: return "\r\n";
|
||||
case LineBreak.Windows: return "\r\n";
|
||||
case LineBreak.Macintosh: return "\r";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue