fix issue 257

This commit is contained in:
Cameron Ross 2020-09-19 18:06:19 -03:00 committed by The Dlang Bot
parent 5171925538
commit fb6d30e50e

View file

@ -232,7 +232,7 @@ final class Reader
///
/// Returns: Bytes starting at current position.
char[] prefixBytes(const size_t length) @safe pure nothrow @nogc
in(length == 0 || bufferOffset_ + length < buffer_.length, "prefixBytes out of bounds")
in(length == 0 || bufferOffset_ + length <= buffer_.length, "prefixBytes out of bounds")
{
return buffer_[bufferOffset_ .. bufferOffset_ + length];
}
@ -887,3 +887,12 @@ void test1Byte(R)()
testUTF!Reader();
test1Byte!Reader();
}
//Issue 257 - https://github.com/dlang-community/D-YAML/issues/257
@safe unittest
{
import dyaml.loader : Loader;
auto yaml = "hello ";
auto root = Loader.fromString(yaml).load();
assert(root.isValid);
}