-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
The string_multiline_12 dumping testcase is failing on zig-nestedtext, and I think it's because of a bug in the testcase.
The input JSON contains the following, which looks as expected:
"the LF character \n\tASCII Linefeed (LF)\nthe CR character \r\tASCII Carriage Return (CR)\n"But the expected output NestedText does not contain the CR - it is replaced with a LF:
$cat -A tests/official_tests/test_cases/string_multiline_12/load_in.nt
>$
> the BS character \^IBackslash (\)$
> the SQ character '^ISingle quote (')$
> the DQ character "^IDouble quote (")$
> the AB character ^G^IASCII Bell (BEL)$
> the BS character ^H^IASCII Backspace (BS)$
> the FF character ^L^IASCII Formfeed (FF)$
> the LF character $
> ^IASCII Linefeed (LF)$
> the CR character $
> ^IASCII Carriage Return (CR)$
> the HT character ^I^IASCII Horizontal Tab (TAB)$
> the VT character ^K^IASCII Vertical Tab (VT)$
> the ES character ^[^IASCII escape character as octal value$
> the ES character ^[^IASCII escape character as hex value$
>
I expected this to be:
$cat -A tests/official_tests/test_cases/string_multiline_12/load_in.nt
...
> the LF character $
> ^IASCII Linefeed (LF)$
> the CR character ^M> ^IASCII Carriage Return (CR)$
...
Admittedly this looks strange, but it can be explained as follows:
- NestedText should be treating CR as a line ending (hence the
>_before the^I, as with LF above) - WSL (where I ran this) doesn't treat CR as a line ending so displays it 'incorrectly'
Unless I'm missing something, I don't think the current behaviour can be justified as desirable because it means CR characters cannot be dumped (they're read in as 'generic line ending' and then dumped out as LF).
The way I handle this in zig-nestedtext is to keep the line endings of multiline string lines so that they can be preserved.
Metadata
Metadata
Assignees
Labels
No labels