allow dyaml.test.representer.testRepresenterTypes to be @safe
This commit is contained in:
parent
c1165b976e
commit
3cfdd7ba56
|
@ -24,7 +24,7 @@ import dyaml.test.constructor;
|
||||||
/// codeFilename = File name to determine test case from.
|
/// codeFilename = File name to determine test case from.
|
||||||
/// Nothing is read from this file, it only exists
|
/// Nothing is read from this file, it only exists
|
||||||
/// to specify that we need a matching unittest.
|
/// to specify that we need a matching unittest.
|
||||||
void testRepresenterTypes(bool verbose, string codeFilename) @trusted
|
void testRepresenterTypes(bool verbose, string codeFilename) @safe
|
||||||
{
|
{
|
||||||
string baseName = codeFilename.baseName.stripExtension;
|
string baseName = codeFilename.baseName.stripExtension;
|
||||||
enforce((baseName in dyaml.test.constructor.expected) !is null,
|
enforce((baseName in dyaml.test.constructor.expected) !is null,
|
||||||
|
@ -33,7 +33,7 @@ void testRepresenterTypes(bool verbose, string codeFilename) @trusted
|
||||||
Node[] expectedNodes = expected[baseName];
|
Node[] expectedNodes = expected[baseName];
|
||||||
foreach(encoding; [Encoding.UTF_8, Encoding.UTF_16, Encoding.UTF_32])
|
foreach(encoding; [Encoding.UTF_8, Encoding.UTF_16, Encoding.UTF_32])
|
||||||
{
|
{
|
||||||
string output;
|
ubyte[] output;
|
||||||
Node[] readNodes;
|
Node[] readNodes;
|
||||||
|
|
||||||
scope(failure)
|
scope(failure)
|
||||||
|
@ -44,7 +44,9 @@ void testRepresenterTypes(bool verbose, string codeFilename) @trusted
|
||||||
foreach(ref n; expectedNodes){writeln(n.debugString, "\n---\n");}
|
foreach(ref n; expectedNodes){writeln(n.debugString, "\n---\n");}
|
||||||
writeln("Read nodes:");
|
writeln("Read nodes:");
|
||||||
foreach(ref n; readNodes){writeln(n.debugString, "\n---\n");}
|
foreach(ref n; readNodes){writeln(n.debugString, "\n---\n");}
|
||||||
writeln("OUTPUT:\n", output);
|
() @trusted {
|
||||||
|
writeln("OUTPUT:\n", cast(string)output);
|
||||||
|
}();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +61,7 @@ void testRepresenterTypes(bool verbose, string codeFilename) @trusted
|
||||||
dumper.encoding = encoding;
|
dumper.encoding = encoding;
|
||||||
dumper.dump(expectedNodes);
|
dumper.dump(expectedNodes);
|
||||||
|
|
||||||
output = cast(string)emitStream.data;
|
output = emitStream.data;
|
||||||
auto constructor = new Constructor;
|
auto constructor = new Constructor;
|
||||||
constructor.addConstructorMapping("!tag1", &constructClass);
|
constructor.addConstructorMapping("!tag1", &constructClass);
|
||||||
constructor.addConstructorScalar("!tag2", &constructStruct);
|
constructor.addConstructorScalar("!tag2", &constructStruct);
|
||||||
|
|
Loading…
Reference in a new issue