Constructor unittests now use the new Loader ctor.
This commit is contained in:
parent
68d9124b17
commit
276bed7fb6
|
@ -852,7 +852,6 @@ Node.Pair[] constructMap(ref Node node)
|
||||||
// Unittests
|
// Unittests
|
||||||
private:
|
private:
|
||||||
|
|
||||||
import std.stream;
|
|
||||||
import dyaml.loader;
|
import dyaml.loader;
|
||||||
|
|
||||||
struct MyStruct
|
struct MyStruct
|
||||||
|
@ -889,9 +888,8 @@ MyStruct constructMyStructMapping(ref Node node)
|
||||||
|
|
||||||
unittest
|
unittest
|
||||||
{
|
{
|
||||||
char[] data = cast(char[])"!mystruct 1:2:3";
|
char[] data = "!mystruct 1:2:3".dup;
|
||||||
auto loadStream = new MemoryStream(data);
|
auto loader = Loader(data);
|
||||||
auto loader = Loader(loadStream);
|
|
||||||
auto constructor = new Constructor;
|
auto constructor = new Constructor;
|
||||||
constructor.addConstructorScalar("!mystruct", &constructMyStructScalar);
|
constructor.addConstructorScalar("!mystruct", &constructMyStructScalar);
|
||||||
loader.constructor = constructor;
|
loader.constructor = constructor;
|
||||||
|
@ -902,9 +900,8 @@ unittest
|
||||||
|
|
||||||
unittest
|
unittest
|
||||||
{
|
{
|
||||||
char[] data = cast(char[])"!mystruct [1, 2, 3]";
|
char[] data = "!mystruct [1, 2, 3]".dup;
|
||||||
auto loadStream = new MemoryStream(data);
|
auto loader = Loader(data);
|
||||||
auto loader = Loader(loadStream);
|
|
||||||
auto constructor = new Constructor;
|
auto constructor = new Constructor;
|
||||||
constructor.addConstructorSequence("!mystruct", &constructMyStructSequence);
|
constructor.addConstructorSequence("!mystruct", &constructMyStructSequence);
|
||||||
loader.constructor = constructor;
|
loader.constructor = constructor;
|
||||||
|
@ -915,9 +912,8 @@ unittest
|
||||||
|
|
||||||
unittest
|
unittest
|
||||||
{
|
{
|
||||||
char[] data = cast(char[])"!mystruct {x: 1, y: 2, z: 3}";
|
char[] data = "!mystruct {x: 1, y: 2, z: 3}".dup;
|
||||||
auto loadStream = new MemoryStream(data);
|
auto loader = Loader(data);
|
||||||
auto loader = Loader(loadStream);
|
|
||||||
auto constructor = new Constructor;
|
auto constructor = new Constructor;
|
||||||
constructor.addConstructorMapping("!mystruct", &constructMyStructMapping);
|
constructor.addConstructorMapping("!mystruct", &constructMyStructMapping);
|
||||||
loader.constructor = constructor;
|
loader.constructor = constructor;
|
||||||
|
|
Loading…
Reference in a new issue