[llvm] r190469 - YAMLIO: Fix string quoting logic.
Nick Lewycky
nlewycky at google.com
Tue Sep 10 18:55:40 PDT 2013
On 10 September 2013 17:45, Rui Ueyama <ruiu at google.com> wrote:
> Author: ruiu
> Date: Tue Sep 10 19:45:48 2013
> New Revision: 190469
>
> URL: http://llvm.org/viewvc/llvm-project?rev=190469&view=rev
> Log:
> YAMLIO: Fix string quoting logic.
>
> YAMLIO printed a string as is without quotes unless it contains a newline
> character. That did not suffice. We also need to quote a string if it
> starts
> with a backquote, quote, double quote or atsign, or it's the empty string.
>
This broke clang-modernize tests which have *_expected.yaml golden files:
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-modernize/HeaderReplacements/
as well as tools/clang/unittests/Tooling/ReplacementsYamlTest.cpp:
[ RUN ] ReplacementsYamlTest.serializesReplacements
tools/clang/unittests/Tooling/ReplacementsYamlTest.cpp:51: Failure
Value of: YamlContentStream.str().c_str()
Actual: "---
MainSourceFile: '"/path/to/source.cpp"'
Context: '"some context"'
Replacements:
- FilePath: '"/path/to/file1.h"'
Offset: 232
Length: 56
ReplacementText: '"replacement #1"'
- FilePath: '"/path/to/file2.h"'
Offset: 301
Length: 2
ReplacementText: '"replacement #2"'
...
"
Expected: "---\n" "MainSourceFile: \"/path/to/source.cpp\"\n" "Context:
\"some context\"\n" "Replacements: \n" " - FilePath: \"/pat
h/to/file1.h\"\n" " Offset: 232\n" " Length: 56\n"
" ReplacementText: \"replacement #1\"\n" " - FilePath: \"/path/to
/file2.h\"\n" " Offset: 301\n" " Length: 2\n" "
ReplacementText: \"replacement #2\"\n" "...\n"
Which is: "---
MainSourceFile: "/path/to/source.cpp"
Context: "some context"
Replacements:
- FilePath: "/path/to/file1.h"
Offset: 232
Length: 56
ReplacementText: "replacement #1"
- FilePath: "/path/to/file2.h"
Offset: 301
Length: 2
ReplacementText: "replacement #2"
...
"
[ FAILED ] ReplacementsYamlTest.serializesReplacements (0 ms)
Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130910/6a2f31cb/attachment.html>
More information about the llvm-commits
mailing list