Fix autoupdate handling of carriage return (#4840)

Switching from RE2 to StrReplaceAll because it seems a fair fit for what
actually needs to be done here. Also pick up \t for visibility reasons.

This came up because clangd's LSP-related APIs print carriage returns.
This commit is contained in:
Jon Ross-Perkins
2025-01-24 16:41:57 +00:00
committed by GitHub
parent bc952b1a4b
commit aec951d7c3
5 changed files with 45 additions and 9 deletions
+19
View File
@@ -0,0 +1,19 @@
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
// SET-CAPTURE-CONSOLE-OUTPUT
// AUTOUPDATE
// TIP: To test this file alone, run:
// TIP: bazel test //testing/file_test:file_test_base_test --test_arg=--file_tests=testing/file_test/testdata/escaping.carbon
// TIP: To dump output, run:
// TIP: bazel run //testing/file_test:file_test_base_test -- --dump_output --file_tests=testing/file_test/testdata/escaping.carbon
// CHECK:STDERR: carriage return{{\r}}
// CHECK:STDERR: {one brace}
// CHECK:STDERR: {{\{\{}}two braces}}
// CHECK:STDERR: [one bracket]
// CHECK:STDERR: {{\[\[}}two brackets]]
// CHECK:STDERR: end of line whitespace {{}}
// CHECK:STDERR: {{\t}}tabs{{\t}}
// CHECK:STDOUT: 2 args: `default_args`, `escaping.carbon`