mirror of
https://github.com/dlang/phobos.git
synced 2025-05-05 01:20:40 +03:00
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.
This commit is contained in:
parent
0512f7ca21
commit
901da0ca29
1 changed files with 16 additions and 3 deletions
19
std/conv.d
19
std/conv.d
|
@ -3123,8 +3123,21 @@ private dchar parseEscape(Source)(ref Source s)
|
||||||
|
|
||||||
unittest
|
unittest
|
||||||
{
|
{
|
||||||
string[] s1 = [ `\"`, `\'`, `\?`, `\\`, `\a`, `\b`, `\f`, `\n`, `\r`, `\t`, `\v` ];
|
string[] s1 = [
|
||||||
string s2 = [ '\"', '\'', '\?', '\\', '\a', '\b', '\f', '\n', '\r', '\t', '\v' ];
|
`\"`, `\'`, `\?`, `\\`, `\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)
|
foreach (i ; 0 .. s1.length)
|
||||||
{
|
{
|
||||||
|
@ -3144,7 +3157,7 @@ unittest
|
||||||
`\x0`, //Premature hex end
|
`\x0`, //Premature hex end
|
||||||
`\XB9`, //Not legal hex syntax
|
`\XB9`, //Not legal hex syntax
|
||||||
`\u!!`, //Not a unicode hex
|
`\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
|
`\u123`, //Premature hex end
|
||||||
`\U123123` //Premature hex end
|
`\U123123` //Premature hex end
|
||||||
];
|
];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue