From 337938f0905b791bccace7d8fcb3802beecc8f90 Mon Sep 17 00:00:00 2001 From: Ferdinand Majerech Date: Thu, 31 Jul 2014 03:12:57 +0200 Subject: [PATCH] Using new Loader ctor in unicode input tests. --- test/src/inputoutput.d | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/src/inputoutput.d b/test/src/inputoutput.d index 246c751..6da55de 100644 --- a/test/src/inputoutput.d +++ b/test/src/inputoutput.d @@ -51,13 +51,13 @@ void testUnicodeInput(bool verbose, string unicodeFilename) string data = readText(unicodeFilename); string expected = data.split().join(" "); - Node output = Loader(new MemoryStream(to!(char[])(data))).load(); + Node output = Loader(cast(void[])data.to!(char[])).load(); assert(output.as!string == expected); - foreach(stream; [new MemoryStream(cast(byte[])(bom16() ~ to!(wchar[])(data))), - new MemoryStream(cast(byte[])(bom32() ~ to!(dchar[])(data)))]) + foreach(buffer; [cast(void[])(bom16() ~ data.to!(wchar[])), + cast(void[])(bom32() ~ data.to!(dchar[]))]) { - output = Loader(stream).load(); + output = Loader(buffer).load(); assert(output.as!string == expected); } } @@ -69,15 +69,15 @@ void testUnicodeInput(bool verbose, string unicodeFilename) void testUnicodeInputErrors(bool verbose, string unicodeFilename) { string data = readText(unicodeFilename); - foreach(stream; [new MemoryStream(cast(byte[])(to!(wchar[])(data))), - new MemoryStream(cast(byte[])(to!(wchar[])(data))), - new MemoryStream(cast(byte[])(bom16(true) ~ to!(wchar[])(data))), - new MemoryStream(cast(byte[])(bom32(true) ~ to!(dchar[])(data)))]) + foreach(buffer; [cast(void[])(data.to!(wchar[])), + cast(void[])(data.to!(dchar[])), + cast(void[])(bom16(true) ~ data.to!(wchar[])), + cast(void[])(bom32(true) ~ data.to!(dchar[]))]) { - try{Loader(stream).load();} + try { Loader(buffer).load(); } catch(YAMLException e) { - if(verbose){writeln(typeid(e).toString(), "\n", e);} + if(verbose) { writeln(typeid(e).toString(), "\n", e); } continue; } assert(false, "Expected an exception");