From 901da0ca297b38f99ad65cb38e2f09c22c9cb19c Mon Sep 17 00:00:00 2001 From: monarch dodra Date: Fri, 1 Mar 2013 11:41:44 +0100 Subject: [PATCH] Update unittest to take into account... ...Octal escapes and named character entities. These still don't work, but there was a test checking octal would throw, which is wrong. --- std/conv.d | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/std/conv.d b/std/conv.d index 86cf6ecb7..8aa572daa 100644 --- a/std/conv.d +++ b/std/conv.d @@ -3123,8 +3123,21 @@ private dchar parseEscape(Source)(ref Source s) unittest { - string[] s1 = [ `\"`, `\'`, `\?`, `\\`, `\a`, `\b`, `\f`, `\n`, `\r`, `\t`, `\v` ]; - string s2 = [ '\"', '\'', '\?', '\\', '\a', '\b', '\f', '\n', '\r', '\t', '\v' ]; + string[] s1 = [ + `\"`, `\'`, `\?`, `\\`, `\a`, `\b`, `\f`, `\n`, `\r`, `\t`, `\v`, //Normal escapes + //`\141`, //@@@9621@@@ Octal escapes. + `\x61`, + `\u65E5`, `\U00012456` + //`\&`, `\"`, //@@@9621@@@ Named Character Entities. + ]; + + const(dchar)[] s2 = [ + '\"', '\'', '\?', '\\', '\a', '\b', '\f', '\n', '\r', '\t', '\v', //Normal escapes + //'\141', //@@@9621@@@ Octal escapes. + '\x61', + '\u65E5', '\U00012456' + //'\&', '\"', //@@@9621@@@ Named Character Entities. + ]; foreach (i ; 0 .. s1.length) { @@ -3144,7 +3157,7 @@ unittest `\x0`, //Premature hex end `\XB9`, //Not legal hex syntax `\u!!`, //Not a unicode hex - `\777`, //Octal, not supported + `\777`, //Octal is larger than a byte //Note: Throws, but simply because octals are unsupported `\u123`, //Premature hex end `\U123123` //Premature hex end ];