From 94adb4241eb07dd61bf32d5eb6a1d1a76acb4d88 Mon Sep 17 00:00:00 2001 From: John-Colvin Date: Tue, 4 Dec 2012 13:50:59 +0000 Subject: [PATCH] modified: dyaml/constructor.d modified: dyaml/node.d modified: test/src/common.d --- dyaml/constructor.d | 30 ++++++++++++++++++++---------- dyaml/node.d | 2 +- test/src/common.d | 2 +- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/dyaml/constructor.d b/dyaml/constructor.d index 95ebbab..e14e192 100644 --- a/dyaml/constructor.d +++ b/dyaml/constructor.d @@ -458,7 +458,8 @@ unittest { long getLong(string str) { - return constructLong(Node(str)); + auto nd = Node(str); + return constructLong(nd); } string canonical = "685230"; @@ -514,7 +515,7 @@ real constructReal(ref Node node) } catch(ConvException e) { - throw new Exception("Unable to parse float value: " ~ value); + throw new Exception("Unable to parse float value: \"" ~ value ~ "\""); } return result; @@ -528,7 +529,8 @@ unittest real getReal(string str) { - return constructReal(Node(str)); + auto nd = Node(str); + return constructReal(nd); } string canonical = "6.8523015e+5"; @@ -570,7 +572,8 @@ unittest char[] buffer; buffer.length = 256; string input = cast(string)Base64.encode(test, buffer); - auto value = constructBinary(Node(input)); + auto nd = Node(input); + auto value = constructBinary(nd); assert(value == test); } @@ -651,7 +654,8 @@ unittest string timestamp(string value) { - return constructTimestamp(Node(value)).toISOString(); + auto nd = Node(value); + return constructTimestamp(nd).toISOString(); } string canonical = "2001-12-15T02:59:43.1Z"; @@ -745,7 +749,8 @@ unittest bool hasDuplicates(Node[] nodes) { - return null !is collectException(constructOrderedMap(Node(nodes))); + auto nd = Node(nodes); + return null !is collectException(constructOrderedMap(nd)); } assert(hasDuplicates(alternateTypes(8) ~ alternateTypes(2))); @@ -815,15 +820,20 @@ unittest } return true; } + + auto ndDuplicatesShort = Node(DuplicatesShort.dup); + auto ndNoDuplicatesShort = Node(noDuplicatesShort.dup); + auto ndDuplicatesLong = Node(DuplicatesLong.dup); + auto ndNoDuplicatesLong = Node(noDuplicatesLong.dup); assert(null !is collectException - (constructSet(Node(DuplicatesShort.dup)))); + (constructSet(ndDuplicatesShort))); assert(null is collectException - (constructSet(Node(noDuplicatesShort.dup)))); + (constructSet(ndNoDuplicatesShort))); assert(null !is collectException - (constructSet(Node(DuplicatesLong.dup)))); + (constructSet(ndDuplicatesLong))); assert(null is collectException - (constructSet(Node(noDuplicatesLong.dup)))); + (constructSet(ndNoDuplicatesLong))); } ///Construct a sequence (array) _node. diff --git a/dyaml/node.d b/dyaml/node.d index 38afc8c..f497478 100644 --- a/dyaml/node.d +++ b/dyaml/node.d @@ -897,7 +897,7 @@ struct Node * Throws: NodeException if the node is not a collection, index is out * of range or if a non-integral index is used on a sequence node. */ - void opIndexAssign(K, V)(V value, K index) @safe + void opIndexAssign(K, V)(V value, K index) @trusted { if(isSequence()) { diff --git a/test/src/common.d b/test/src/common.d index 6ba4c4f..7248656 100644 --- a/test/src/common.d +++ b/test/src/common.d @@ -36,7 +36,7 @@ void run(F ...)(string testName, void function(bool, F) testFunction, { immutable string dataDir = "test/data"; auto testFilenames = findTestFilenames(dataDir); - bool verbose = false; + bool verbose = true; Result[] results; if(unittestExt.length > 0)