Minor unittest improvement.

This commit is contained in:
Ferdinand Majerech 2014-07-19 02:00:04 +02:00
parent 4a76d4b886
commit e6755e6615

View file

@ -772,19 +772,23 @@ struct Node
writeln("D:YAML Node opIndex unittest"); writeln("D:YAML Node opIndex unittest");
alias Node.Value Value; alias Node.Value Value;
alias Node.Pair Pair; alias Node.Pair Pair;
Node n1 = Node(cast(long)11);
Node n2 = Node(cast(long)12);
Node n3 = Node(cast(long)13);
Node n4 = Node(cast(long)14);
Node k1 = Node("11"); Node narray = Node([11, 12, 13, 14]);
Node k2 = Node("12"); Node nmap = Node(["11", "12", "13", "14"], [11, 12, 13, 14]);
Node k3 = Node("13");
Node k4 = Node("14");
Node narray = Node([n1, n2, n3, n4]); assert(narray[0].as!int == 11);
Node nmap = Node([k1, k2, k3, k4], assert(null !is collectException(narray[42]));
[n1, n2, n3, n4]); assert(nmap["11"].as!int == 11);
assert(nmap["14"].as!int == 14);
}
unittest
{
writeln("D:YAML Node opIndex unittest");
alias Node.Value Value;
alias Node.Pair Pair;
Node narray = Node([11, 12, 13, 14]);
Node nmap = Node(["11", "12", "13", "14"], [11, 12, 13, 14]);
assert(narray[0].as!int == 11); assert(narray[0].as!int == 11);
assert(null !is collectException(narray[42])); assert(null !is collectException(narray[42]));