minor refactor: move tests to dyaml.test.*, remove spaces at ends of lines (#91)
minor refactor: move tests to dyaml.test.*, remove spaces at ends of lines merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
This commit is contained in:
parent
e7ea38652b
commit
5ad4c3c435
20
meson.build
20
meson.build
|
@ -39,16 +39,16 @@ dyaml_src = [
|
||||||
'source/dyaml/style.d',
|
'source/dyaml/style.d',
|
||||||
'source/dyaml/tag.d',
|
'source/dyaml/tag.d',
|
||||||
'source/dyaml/tagdirective.d',
|
'source/dyaml/tagdirective.d',
|
||||||
'source/dyaml/testcommon.d',
|
'source/dyaml/test/common.d',
|
||||||
'source/dyaml/testcompare.d',
|
'source/dyaml/test/compare.d',
|
||||||
'source/dyaml/testconstructor.d',
|
'source/dyaml/test/constructor.d',
|
||||||
'source/dyaml/testemitter.d',
|
'source/dyaml/test/emitter.d',
|
||||||
'source/dyaml/testerrors.d',
|
'source/dyaml/test/errors.d',
|
||||||
'source/dyaml/testinputoutput.d',
|
'source/dyaml/test/inputoutput.d',
|
||||||
'source/dyaml/testreader.d',
|
'source/dyaml/test/reader.d',
|
||||||
'source/dyaml/testrepresenter.d',
|
'source/dyaml/test/representer.d',
|
||||||
'source/dyaml/testresolver.d',
|
'source/dyaml/test/resolver.d',
|
||||||
'source/dyaml/testtokens.d',
|
'source/dyaml/test/tokens.d',
|
||||||
'source/dyaml/token.d',
|
'source/dyaml/token.d',
|
||||||
'source/dyaml/unused.d',
|
'source/dyaml/unused.d',
|
||||||
'source/dyaml/zerostring.d',
|
'source/dyaml/zerostring.d',
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
module dyaml.testcommon;
|
module dyaml.test.common;
|
||||||
|
|
||||||
version(unittest)
|
version(unittest)
|
||||||
{
|
{
|
||||||
|
@ -31,10 +31,10 @@ package:
|
||||||
* unittestExt = Extensions of data files needed for the unittest.
|
* unittestExt = Extensions of data files needed for the unittest.
|
||||||
* skipExt = Extensions that must not be used for the unittest.
|
* skipExt = Extensions that must not be used for the unittest.
|
||||||
*/
|
*/
|
||||||
void run(F ...)(string testName, void function(bool, F) testFunction,
|
void run(F ...)(string testName, void function(bool, F) testFunction,
|
||||||
string[] unittestExt, string[] skipExt = [])
|
string[] unittestExt, string[] skipExt = [])
|
||||||
{
|
{
|
||||||
immutable string dataDir = __FILE_FULL_PATH__.dirName ~ "/../../test/data";
|
immutable string dataDir = __FILE_FULL_PATH__.dirName ~ "/../../../test/data";
|
||||||
auto testFilenames = findTestFilenames(dataDir);
|
auto testFilenames = findTestFilenames(dataDir);
|
||||||
bool verbose = false;
|
bool verbose = false;
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ body
|
||||||
*
|
*
|
||||||
* Returns: Information about the results of the unittest.
|
* Returns: Information about the results of the unittest.
|
||||||
*/
|
*/
|
||||||
Result execute(F ...)(const string testName, void function(bool, F) testFunction,
|
Result execute(F ...)(const string testName, void function(bool, F) testFunction,
|
||||||
string[] filenames, const bool verbose)
|
string[] filenames, const bool verbose)
|
||||||
{
|
{
|
||||||
if(verbose)
|
if(verbose)
|
||||||
|
@ -155,7 +155,7 @@ Result execute(F ...)(const string testName, void function(bool, F) testFunction
|
||||||
kind = (typeid(e) is typeid(AssertError)) ? TestStatus.Failure : TestStatus.Error;
|
kind = (typeid(e) is typeid(AssertError)) ? TestStatus.Failure : TestStatus.Error;
|
||||||
write((verbose ? to!string(e) : to!string(kind)) ~ " ");
|
write((verbose ? to!string(e) : to!string(kind)) ~ " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
stdout.flush();
|
stdout.flush();
|
||||||
|
|
||||||
return Result(testName, filenames, kind, info);
|
return Result(testName, filenames, kind, info);
|
||||||
|
@ -165,7 +165,7 @@ Result execute(F ...)(const string testName, void function(bool, F) testFunction
|
||||||
* Display unittest results.
|
* Display unittest results.
|
||||||
*
|
*
|
||||||
* Params: results = Unittest results.
|
* Params: results = Unittest results.
|
||||||
* verbose = Print verbose output?
|
* verbose = Print verbose output?
|
||||||
*/
|
*/
|
||||||
void display(Result[] results, const bool verbose)
|
void display(Result[] results, const bool verbose)
|
||||||
{
|
{
|
||||||
|
@ -183,7 +183,7 @@ void display(Result[] results, const bool verbose)
|
||||||
{
|
{
|
||||||
if(verbose)
|
if(verbose)
|
||||||
{
|
{
|
||||||
writeln(result.name, "(" ~ result.filenames.join(", ") ~ "): ",
|
writeln(result.name, "(" ~ result.filenames.join(", ") ~ "): ",
|
||||||
to!string(result.kind));
|
to!string(result.kind));
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,18 +4,18 @@
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
module dyaml.testcompare;
|
module dyaml.test.compare;
|
||||||
|
|
||||||
|
|
||||||
version(unittest)
|
version(unittest)
|
||||||
{
|
{
|
||||||
|
|
||||||
import dyaml.testcommon;
|
import dyaml.test.common;
|
||||||
import dyaml.token;
|
import dyaml.token;
|
||||||
|
|
||||||
|
|
||||||
/// Test parser by comparing output from parsing two equivalent YAML files.
|
/// Test parser by comparing output from parsing two equivalent YAML files.
|
||||||
///
|
///
|
||||||
/// Params: verbose = Print verbose output?
|
/// Params: verbose = Print verbose output?
|
||||||
/// dataFilename = YAML file to parse.
|
/// dataFilename = YAML file to parse.
|
||||||
/// canonicalFilename = Another file to parse, in canonical YAML format.
|
/// canonicalFilename = Another file to parse, in canonical YAML format.
|
||||||
|
@ -34,7 +34,7 @@ void testParser(bool verbose, string dataFilename, string canonicalFilename)
|
||||||
|
|
||||||
|
|
||||||
/// Test loader by comparing output from loading two equivalent YAML files.
|
/// Test loader by comparing output from loading two equivalent YAML files.
|
||||||
///
|
///
|
||||||
/// Params: verbose = Print verbose output?
|
/// Params: verbose = Print verbose output?
|
||||||
/// dataFilename = YAML file to load.
|
/// dataFilename = YAML file to load.
|
||||||
/// canonicalFilename = Another file to load, in canonical YAML format.
|
/// canonicalFilename = Another file to load, in canonical YAML format.
|
|
@ -4,7 +4,7 @@
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
module dyaml.testconstructor;
|
module dyaml.test.constructor;
|
||||||
|
|
||||||
|
|
||||||
version(unittest)
|
version(unittest)
|
||||||
|
@ -17,7 +17,7 @@ import std.string;
|
||||||
import std.typecons;
|
import std.typecons;
|
||||||
|
|
||||||
import dyaml.tag;
|
import dyaml.tag;
|
||||||
import dyaml.testcommon;
|
import dyaml.test.common;
|
||||||
|
|
||||||
|
|
||||||
///Expected results of loading test inputs.
|
///Expected results of loading test inputs.
|
||||||
|
@ -100,7 +100,7 @@ Node[] constructBool()
|
||||||
|
|
||||||
Node[] constructCustom()
|
Node[] constructCustom()
|
||||||
{
|
{
|
||||||
return [Node([Node(new TestClass(1, 2, 3)),
|
return [Node([Node(new TestClass(1, 2, 3)),
|
||||||
Node(TestStruct(10))])];
|
Node(TestStruct(10))])];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,36 +126,36 @@ Node[] constructInt()
|
||||||
|
|
||||||
Node[] constructMap()
|
Node[] constructMap()
|
||||||
{
|
{
|
||||||
return [Node([pair("Block style",
|
return [Node([pair("Block style",
|
||||||
[pair("Clark", "Evans"),
|
[pair("Clark", "Evans"),
|
||||||
pair("Brian", "Ingerson"),
|
pair("Brian", "Ingerson"),
|
||||||
pair("Oren", "Ben-Kiki")]),
|
pair("Oren", "Ben-Kiki")]),
|
||||||
pair("Flow style",
|
pair("Flow style",
|
||||||
[pair("Clark", "Evans"),
|
[pair("Clark", "Evans"),
|
||||||
pair("Brian", "Ingerson"),
|
pair("Brian", "Ingerson"),
|
||||||
pair("Oren", "Ben-Kiki")])])];
|
pair("Oren", "Ben-Kiki")])])];
|
||||||
}
|
}
|
||||||
|
|
||||||
Node[] constructMerge()
|
Node[] constructMerge()
|
||||||
{
|
{
|
||||||
return [Node([Node([pair("x", 1L), pair("y", 2L)]),
|
return [Node([Node([pair("x", 1L), pair("y", 2L)]),
|
||||||
Node([pair("x", 0L), pair("y", 2L)]),
|
Node([pair("x", 0L), pair("y", 2L)]),
|
||||||
Node([pair("r", 10L)]),
|
Node([pair("r", 10L)]),
|
||||||
Node([pair("r", 1L)]),
|
Node([pair("r", 1L)]),
|
||||||
Node([pair("x", 1L), pair("y", 2L), pair("r", 10L), pair("label", "center/big")]),
|
Node([pair("x", 1L), pair("y", 2L), pair("r", 10L), pair("label", "center/big")]),
|
||||||
Node([pair("r", 10L), pair("label", "center/big"), pair("x", 1L), pair("y", 2L)]),
|
Node([pair("r", 10L), pair("label", "center/big"), pair("x", 1L), pair("y", 2L)]),
|
||||||
Node([pair("label", "center/big"), pair("x", 1L), pair("y", 2L), pair("r", 10L)]),
|
Node([pair("label", "center/big"), pair("x", 1L), pair("y", 2L), pair("r", 10L)]),
|
||||||
Node([pair("x", 1L), pair("label", "center/big"), pair("r", 10L), pair("y", 2L)])])];
|
Node([pair("x", 1L), pair("label", "center/big"), pair("r", 10L), pair("y", 2L)])])];
|
||||||
}
|
}
|
||||||
|
|
||||||
Node[] constructNull()
|
Node[] constructNull()
|
||||||
{
|
{
|
||||||
return [Node(YAMLNull()),
|
return [Node(YAMLNull()),
|
||||||
Node([pair("empty", YAMLNull()),
|
Node([pair("empty", YAMLNull()),
|
||||||
pair("canonical", YAMLNull()),
|
pair("canonical", YAMLNull()),
|
||||||
pair("english", YAMLNull()),
|
pair("english", YAMLNull()),
|
||||||
pair(YAMLNull(), "null key")]),
|
pair(YAMLNull(), "null key")]),
|
||||||
Node([pair("sparse",
|
Node([pair("sparse",
|
||||||
[Node(YAMLNull()),
|
[Node(YAMLNull()),
|
||||||
Node("2nd entry"),
|
Node("2nd entry"),
|
||||||
Node(YAMLNull()),
|
Node(YAMLNull()),
|
||||||
|
@ -165,33 +165,33 @@ Node[] constructNull()
|
||||||
|
|
||||||
Node[] constructOMap()
|
Node[] constructOMap()
|
||||||
{
|
{
|
||||||
return [Node([pair("Bestiary",
|
return [Node([pair("Bestiary",
|
||||||
[pair("aardvark", "African pig-like ant eater. Ugly."),
|
[pair("aardvark", "African pig-like ant eater. Ugly."),
|
||||||
pair("anteater", "South-American ant eater. Two species."),
|
pair("anteater", "South-American ant eater. Two species."),
|
||||||
pair("anaconda", "South-American constrictor snake. Scaly.")]),
|
pair("anaconda", "South-American constrictor snake. Scaly.")]),
|
||||||
pair("Numbers",[pair("one", 1L),
|
pair("Numbers",[pair("one", 1L),
|
||||||
pair("two", 2L),
|
pair("two", 2L),
|
||||||
pair("three", 3L)])])];
|
pair("three", 3L)])])];
|
||||||
}
|
}
|
||||||
|
|
||||||
Node[] constructPairs()
|
Node[] constructPairs()
|
||||||
{
|
{
|
||||||
return [Node([pair("Block tasks",
|
return [Node([pair("Block tasks",
|
||||||
Node([pair("meeting", "with team."),
|
Node([pair("meeting", "with team."),
|
||||||
pair("meeting", "with boss."),
|
pair("meeting", "with boss."),
|
||||||
pair("break", "lunch."),
|
pair("break", "lunch."),
|
||||||
pair("meeting", "with client.")], "tag:yaml.org,2002:pairs")),
|
pair("meeting", "with client.")], "tag:yaml.org,2002:pairs")),
|
||||||
pair("Flow tasks",
|
pair("Flow tasks",
|
||||||
Node([pair("meeting", "with team"),
|
Node([pair("meeting", "with team"),
|
||||||
pair("meeting", "with boss")], "tag:yaml.org,2002:pairs"))])];
|
pair("meeting", "with boss")], "tag:yaml.org,2002:pairs"))])];
|
||||||
}
|
}
|
||||||
|
|
||||||
Node[] constructSeq()
|
Node[] constructSeq()
|
||||||
{
|
{
|
||||||
return [Node([pair("Block style",
|
return [Node([pair("Block style",
|
||||||
[Node("Mercury"), Node("Venus"), Node("Earth"), Node("Mars"),
|
[Node("Mercury"), Node("Venus"), Node("Earth"), Node("Mars"),
|
||||||
Node("Jupiter"), Node("Saturn"), Node("Uranus"), Node("Neptune"),
|
Node("Jupiter"), Node("Saturn"), Node("Uranus"), Node("Neptune"),
|
||||||
Node("Pluto")]),
|
Node("Pluto")]),
|
||||||
pair("Flow style",
|
pair("Flow style",
|
||||||
[Node("Mercury"), Node("Venus"), Node("Earth"), Node("Mars"),
|
[Node("Mercury"), Node("Venus"), Node("Earth"), Node("Mars"),
|
||||||
Node("Jupiter"), Node("Saturn"), Node("Uranus"), Node("Neptune"),
|
Node("Jupiter"), Node("Saturn"), Node("Uranus"), Node("Neptune"),
|
||||||
|
@ -201,8 +201,8 @@ Node[] constructSeq()
|
||||||
Node[] constructSet()
|
Node[] constructSet()
|
||||||
{
|
{
|
||||||
return [Node([pair("baseball players",
|
return [Node([pair("baseball players",
|
||||||
[Node("Mark McGwire"), Node("Sammy Sosa"), Node("Ken Griffey")]),
|
[Node("Mark McGwire"), Node("Sammy Sosa"), Node("Ken Griffey")]),
|
||||||
pair("baseball teams",
|
pair("baseball teams",
|
||||||
[Node("Boston Red Sox"), Node("Detroit Tigers"), Node("New York Yankees")])])];
|
[Node("Boston Red Sox"), Node("Detroit Tigers"), Node("New York Yankees")])])];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ Node[] constructTimestamp()
|
||||||
{
|
{
|
||||||
alias DT = DateTime;
|
alias DT = DateTime;
|
||||||
alias ST = SysTime;
|
alias ST = SysTime;
|
||||||
return [Node([pair("canonical", ST(DT(2001, 12, 15, 2, 59, 43), 1000000.dur!"hnsecs", UTC())),
|
return [Node([pair("canonical", ST(DT(2001, 12, 15, 2, 59, 43), 1000000.dur!"hnsecs", UTC())),
|
||||||
pair("valid iso8601", ST(DT(2001, 12, 15, 2, 59, 43), 1000000.dur!"hnsecs", UTC())),
|
pair("valid iso8601", ST(DT(2001, 12, 15, 2, 59, 43), 1000000.dur!"hnsecs", UTC())),
|
||||||
pair("space separated", ST(DT(2001, 12, 15, 2, 59, 43), 1000000.dur!"hnsecs", UTC())),
|
pair("space separated", ST(DT(2001, 12, 15, 2, 59, 43), 1000000.dur!"hnsecs", UTC())),
|
||||||
pair("no time zone (Z)", ST(DT(2001, 12, 15, 2, 59, 43), 1000000.dur!"hnsecs", UTC())),
|
pair("no time zone (Z)", ST(DT(2001, 12, 15, 2, 59, 43), 1000000.dur!"hnsecs", UTC())),
|
||||||
|
@ -234,26 +234,26 @@ Node[] constructTimestamp()
|
||||||
|
|
||||||
Node[] constructValue()
|
Node[] constructValue()
|
||||||
{
|
{
|
||||||
return[Node([pair("link with",
|
return[Node([pair("link with",
|
||||||
[Node("library1.dll"), Node("library2.dll")])]),
|
[Node("library1.dll"), Node("library2.dll")])]),
|
||||||
Node([pair("link with",
|
Node([pair("link with",
|
||||||
[Node([pair("=", "library1.dll"), pair("version", cast(real)1.2)]),
|
[Node([pair("=", "library1.dll"), pair("version", cast(real)1.2)]),
|
||||||
Node([pair("=", "library2.dll"), pair("version", cast(real)2.3)])])])];
|
Node([pair("=", "library2.dll"), pair("version", cast(real)2.3)])])])];
|
||||||
}
|
}
|
||||||
|
|
||||||
Node[] duplicateMergeKey()
|
Node[] duplicateMergeKey()
|
||||||
{
|
{
|
||||||
return [Node([pair("foo", "bar"),
|
return [Node([pair("foo", "bar"),
|
||||||
pair("x", 1L),
|
pair("x", 1L),
|
||||||
pair("y", 2L),
|
pair("y", 2L),
|
||||||
pair("z", 3L),
|
pair("z", 3L),
|
||||||
pair("t", 4L)])];
|
pair("t", 4L)])];
|
||||||
}
|
}
|
||||||
|
|
||||||
Node[] floatRepresenterBug()
|
Node[] floatRepresenterBug()
|
||||||
{
|
{
|
||||||
return [Node([pair(cast(real)1.0, 1L),
|
return [Node([pair(cast(real)1.0, 1L),
|
||||||
pair(real.infinity, 10L),
|
pair(real.infinity, 10L),
|
||||||
pair(-real.infinity, -10L),
|
pair(-real.infinity, -10L),
|
||||||
pair(real.nan, 100L)])];
|
pair(real.nan, 100L)])];
|
||||||
}
|
}
|
||||||
|
@ -289,10 +289,10 @@ Node[] timestampBugs()
|
||||||
alias DT = DateTime;
|
alias DT = DateTime;
|
||||||
alias ST = SysTime;
|
alias ST = SysTime;
|
||||||
alias STZ = immutable SimpleTimeZone;
|
alias STZ = immutable SimpleTimeZone;
|
||||||
return [Node([Node(ST(DT(2001, 12, 15, 3, 29, 43), 1000000.dur!"hnsecs", UTC())),
|
return [Node([Node(ST(DT(2001, 12, 15, 3, 29, 43), 1000000.dur!"hnsecs", UTC())),
|
||||||
Node(ST(DT(2001, 12, 14, 16, 29, 43), 1000000.dur!"hnsecs", UTC())),
|
Node(ST(DT(2001, 12, 14, 16, 29, 43), 1000000.dur!"hnsecs", UTC())),
|
||||||
Node(ST(DT(2001, 12, 14, 21, 59, 43), 10100.dur!"hnsecs", UTC())),
|
Node(ST(DT(2001, 12, 14, 21, 59, 43), 10100.dur!"hnsecs", UTC())),
|
||||||
Node(ST(DT(2001, 12, 14, 21, 59, 43), new STZ(60.dur!"minutes"))),
|
Node(ST(DT(2001, 12, 14, 21, 59, 43), new STZ(60.dur!"minutes"))),
|
||||||
Node(ST(DT(2001, 12, 14, 21, 59, 43), new STZ(-90.dur!"minutes"))),
|
Node(ST(DT(2001, 12, 14, 21, 59, 43), new STZ(-90.dur!"minutes"))),
|
||||||
Node(ST(DT(2005, 7, 8, 17, 35, 4), 5176000.dur!"hnsecs", UTC()))])];
|
Node(ST(DT(2005, 7, 8, 17, 35, 4), 5176000.dur!"hnsecs", UTC()))])];
|
||||||
}
|
}
|
||||||
|
@ -324,8 +324,8 @@ class TestClass
|
||||||
|
|
||||||
this(int x, int y, int z)
|
this(int x, int y, int z)
|
||||||
{
|
{
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
this.z = z;
|
this.z = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,7 +357,7 @@ struct TestStruct
|
||||||
const int opCmp(ref const TestStruct s)
|
const int opCmp(ref const TestStruct s)
|
||||||
{
|
{
|
||||||
return value - s.value;
|
return value - s.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Constructor function for TestClass.
|
///Constructor function for TestClass.
|
||||||
|
@ -367,16 +367,16 @@ TestClass constructClass(ref Node node)
|
||||||
}
|
}
|
||||||
|
|
||||||
Node representClass(ref Node node, Representer representer)
|
Node representClass(ref Node node, Representer representer)
|
||||||
{
|
{
|
||||||
auto value = node.as!TestClass;
|
auto value = node.as!TestClass;
|
||||||
auto pairs = [Node.Pair("x", value.x),
|
auto pairs = [Node.Pair("x", value.x),
|
||||||
Node.Pair("y", value.y),
|
Node.Pair("y", value.y),
|
||||||
Node.Pair("z", value.z)];
|
Node.Pair("z", value.z)];
|
||||||
auto result = representer.representMapping("!tag1", pairs);
|
auto result = representer.representMapping("!tag1", pairs);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
///Constructor function for TestStruct.
|
///Constructor function for TestStruct.
|
||||||
TestStruct constructStruct(ref Node node)
|
TestStruct constructStruct(ref Node node)
|
||||||
{
|
{
|
|
@ -4,7 +4,7 @@
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
module dyaml.testemitter;
|
module dyaml.test.emitter;
|
||||||
|
|
||||||
|
|
||||||
version(unittest)
|
version(unittest)
|
||||||
|
@ -18,7 +18,7 @@ import std.typecons;
|
||||||
import dyaml.stream;
|
import dyaml.stream;
|
||||||
import dyaml.dumper;
|
import dyaml.dumper;
|
||||||
import dyaml.event;
|
import dyaml.event;
|
||||||
import dyaml.testcommon;
|
import dyaml.test.common;
|
||||||
import dyaml.token;
|
import dyaml.token;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
module dyaml.testerrors;
|
module dyaml.test.errors;
|
||||||
|
|
||||||
|
|
||||||
version(unittest)
|
version(unittest)
|
||||||
|
@ -12,7 +12,7 @@ version(unittest)
|
||||||
|
|
||||||
import std.file;
|
import std.file;
|
||||||
|
|
||||||
import dyaml.testcommon;
|
import dyaml.test.common;
|
||||||
|
|
||||||
|
|
||||||
/// Loader error unittest from file stream.
|
/// Loader error unittest from file stream.
|
|
@ -4,7 +4,7 @@
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
module dyaml.testinputoutput;
|
module dyaml.test.inputoutput;
|
||||||
|
|
||||||
|
|
||||||
version(unittest)
|
version(unittest)
|
||||||
|
@ -14,16 +14,16 @@ import std.array;
|
||||||
import std.file;
|
import std.file;
|
||||||
import std.system;
|
import std.system;
|
||||||
|
|
||||||
import dyaml.testcommon;
|
import dyaml.test.common;
|
||||||
import dyaml.stream;
|
import dyaml.stream;
|
||||||
|
|
||||||
|
|
||||||
alias std.system.endian endian;
|
alias std.system.endian endian;
|
||||||
|
|
||||||
/// Get an UTF-16 byte order mark.
|
/// Get an UTF-16 byte order mark.
|
||||||
///
|
///
|
||||||
/// Params: wrong = Get the incorrect BOM for this system.
|
/// Params: wrong = Get the incorrect BOM for this system.
|
||||||
///
|
///
|
||||||
/// Returns: UTF-16 byte order mark.
|
/// Returns: UTF-16 byte order mark.
|
||||||
wchar bom16(bool wrong = false) pure
|
wchar bom16(bool wrong = false) pure
|
||||||
{
|
{
|
||||||
|
@ -34,9 +34,9 @@ wchar bom16(bool wrong = false) pure
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get an UTF-32 byte order mark.
|
/// Get an UTF-32 byte order mark.
|
||||||
///
|
///
|
||||||
/// Params: wrong = Get the incorrect BOM for this system.
|
/// Params: wrong = Get the incorrect BOM for this system.
|
||||||
///
|
///
|
||||||
/// Returns: UTF-32 byte order mark.
|
/// Returns: UTF-32 byte order mark.
|
||||||
dchar bom32(bool wrong = false) pure
|
dchar bom32(bool wrong = false) pure
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,7 @@ dchar bom32(bool wrong = false) pure
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Unicode input unittest. Tests various encodings.
|
/// Unicode input unittest. Tests various encodings.
|
||||||
///
|
///
|
||||||
/// Params: verbose = Print verbose output?
|
/// Params: verbose = Print verbose output?
|
||||||
/// unicodeFilename = File name to read from.
|
/// unicodeFilename = File name to read from.
|
||||||
void testUnicodeInput(bool verbose, string unicodeFilename)
|
void testUnicodeInput(bool verbose, string unicodeFilename)
|
||||||
|
@ -58,7 +58,7 @@ void testUnicodeInput(bool verbose, string unicodeFilename)
|
||||||
Node output = Loader(cast(void[])data.to!(char[])).load();
|
Node output = Loader(cast(void[])data.to!(char[])).load();
|
||||||
assert(output.as!string == expected);
|
assert(output.as!string == expected);
|
||||||
|
|
||||||
foreach(buffer; [cast(void[])(bom16() ~ data.to!(wchar[])),
|
foreach(buffer; [cast(void[])(bom16() ~ data.to!(wchar[])),
|
||||||
cast(void[])(bom32() ~ data.to!(dchar[]))])
|
cast(void[])(bom32() ~ data.to!(dchar[]))])
|
||||||
{
|
{
|
||||||
output = Loader(buffer).load();
|
output = Loader(buffer).load();
|
||||||
|
@ -67,7 +67,7 @@ void testUnicodeInput(bool verbose, string unicodeFilename)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Unicode input error unittest. Tests various encodings with incorrect BOMs.
|
/// Unicode input error unittest. Tests various encodings with incorrect BOMs.
|
||||||
///
|
///
|
||||||
/// Params: verbose = Print verbose output?
|
/// Params: verbose = Print verbose output?
|
||||||
/// unicodeFilename = File name to read from.
|
/// unicodeFilename = File name to read from.
|
||||||
void testUnicodeInputErrors(bool verbose, string unicodeFilename)
|
void testUnicodeInputErrors(bool verbose, string unicodeFilename)
|
|
@ -4,13 +4,13 @@
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
module dyaml.testreader;
|
module dyaml.test.reader;
|
||||||
|
|
||||||
|
|
||||||
version(unittest)
|
version(unittest)
|
||||||
{
|
{
|
||||||
|
|
||||||
import dyaml.testcommon;
|
import dyaml.test.common;
|
||||||
import dyaml.reader;
|
import dyaml.reader;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
module dyaml.testrepresenter;
|
module dyaml.test.representer;
|
||||||
|
|
||||||
|
|
||||||
version(unittest)
|
version(unittest)
|
||||||
|
@ -14,8 +14,8 @@ import std.path;
|
||||||
import std.exception;
|
import std.exception;
|
||||||
import std.typecons;
|
import std.typecons;
|
||||||
|
|
||||||
import dyaml.testcommon;
|
import dyaml.test.common;
|
||||||
import dyaml.testconstructor;
|
import dyaml.test.constructor;
|
||||||
|
|
||||||
|
|
||||||
/// Representer unittest.
|
/// Representer unittest.
|
||||||
|
@ -27,7 +27,7 @@ import dyaml.testconstructor;
|
||||||
void testRepresenterTypes(bool verbose, string codeFilename)
|
void testRepresenterTypes(bool verbose, string codeFilename)
|
||||||
{
|
{
|
||||||
string baseName = codeFilename.baseName.stripExtension;
|
string baseName = codeFilename.baseName.stripExtension;
|
||||||
enforce((baseName in dyaml.testconstructor.expected) !is null,
|
enforce((baseName in dyaml.test.constructor.expected) !is null,
|
||||||
new Exception("Unimplemented representer test: " ~ baseName));
|
new Exception("Unimplemented representer test: " ~ baseName));
|
||||||
|
|
||||||
Node[] expectedNodes = expected[baseName];
|
Node[] expectedNodes = expected[baseName];
|
|
@ -4,7 +4,7 @@
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
module dyaml.testresolver;
|
module dyaml.test.resolver;
|
||||||
|
|
||||||
|
|
||||||
version(unittest)
|
version(unittest)
|
||||||
|
@ -13,7 +13,7 @@ version(unittest)
|
||||||
import std.file;
|
import std.file;
|
||||||
import std.string;
|
import std.string;
|
||||||
|
|
||||||
import dyaml.testcommon;
|
import dyaml.test.common;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -4,7 +4,7 @@
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
module dyaml.testtokens;
|
module dyaml.test.tokens;
|
||||||
|
|
||||||
|
|
||||||
version(unittest)
|
version(unittest)
|
||||||
|
@ -13,7 +13,7 @@ version(unittest)
|
||||||
import std.array;
|
import std.array;
|
||||||
import std.file;
|
import std.file;
|
||||||
|
|
||||||
import dyaml.testcommon;
|
import dyaml.test.common;
|
||||||
import dyaml.token;
|
import dyaml.token;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue