Temporaries in constructor.d due to changes in ref passing (by John Colvin).

This commit is contained in:
Kiith-Sa 2012-12-27 22:10:29 +01:00
parent ea0237c716
commit 539f5837d6

View file

@ -328,6 +328,7 @@ final class Constructor
enforce((tag in *delegates!T) !is null,
new Error("No constructor function from " ~ type ~
" for tag " ~ tag.get(), start, end));
Node node = Node(value);
try
{
@ -458,7 +459,8 @@ unittest
{
long getLong(string str)
{
return constructLong(Node(str));
auto node = Node(str);
return constructLong(node);
}
string canonical = "685230";
@ -528,7 +530,8 @@ unittest
real getReal(string str)
{
return constructReal(Node(str));
auto node = Node(str);
return constructReal(node);
}
string canonical = "6.8523015e+5";
@ -570,7 +573,8 @@ unittest
char[] buffer;
buffer.length = 256;
string input = cast(string)Base64.encode(test, buffer);
auto value = constructBinary(Node(input));
auto node = Node(input);
auto value = constructBinary(node);
assert(value == test);
}
@ -651,7 +655,8 @@ unittest
string timestamp(string value)
{
return constructTimestamp(Node(value)).toISOString();
auto node = Node(value);
return constructTimestamp(node).toISOString();
}
string canonical = "2001-12-15T02:59:43.1Z";
@ -745,7 +750,8 @@ unittest
bool hasDuplicates(Node[] nodes)
{
return null !is collectException(constructOrderedMap(Node(nodes)));
auto node = Node(nodes);
return null !is collectException(constructOrderedMap(node));
}
assert(hasDuplicates(alternateTypes(8) ~ alternateTypes(2)));
@ -816,14 +822,15 @@ unittest
return true;
}
assert(null !is collectException
(constructSet(Node(DuplicatesShort.dup))));
assert(null is collectException
(constructSet(Node(noDuplicatesShort.dup))));
assert(null !is collectException
(constructSet(Node(DuplicatesLong.dup))));
assert(null is collectException
(constructSet(Node(noDuplicatesLong.dup))));
auto nodeDuplicatesShort = Node(DuplicatesShort.dup);
auto nodeNoDuplicatesShort = Node(noDuplicatesShort.dup);
auto nodeDuplicatesLong = Node(DuplicatesLong.dup);
auto nodeNoDuplicatesLong = Node(noDuplicatesLong.dup);
assert(null !is collectException(constructSet(nodeDuplicatesShort)));
assert(null is collectException(constructSet(nodeNoDuplicatesShort)));
assert(null !is collectException(constructSet(nodeDuplicatesLong)));
assert(null is collectException(constructSet(nodeNoDuplicatesLong)));
}
///Construct a sequence (array) _node.