Skip to content

Commit 42da2fa

Browse files
authored
Used verbatim strings (#8952)
1 parent 69c5f15 commit 42da2fa

File tree

5 files changed

+15
-14
lines changed

5 files changed

+15
-14
lines changed

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ resharper_enforce_lock_statement_braces_highlighting = error
120120
resharper_enforce_using_statement_braces_highlighting = error
121121
resharper_enforce_while_statement_braces_highlighting = error
122122
resharper_use_utf8_string_literal_highlighting = error
123+
resharper_use_verbatim_string_highlighting = error
123124

124125
# ReSharper properties
125126
resharper_align_multiline_binary_expressions_chain = false

src/CookieCrumble/src/CookieCrumble/Snapshot.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,9 +506,9 @@ private static bool MatchSnapshot(
506506
if (OperatingSystem.IsWindows())
507507
{
508508
// Normalize escaped line endings if the expected value does not explicitly contain them.
509-
if (!before.Contains("\\r\\n", StringComparison.Ordinal))
509+
if (!before.Contains(@"\r\n", StringComparison.Ordinal))
510510
{
511-
after = after.Replace("\\r\\n", "\\n");
511+
after = after.Replace(@"\r\n", @"\n");
512512
}
513513
}
514514

src/GreenDonut/src/GreenDonut.Data/Cursors/CursorKeySerializerHelper.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ namespace GreenDonut.Data.Cursors;
55

66
internal static class CursorKeySerializerHelper
77
{
8-
public static ReadOnlySpan<byte> Null => "\\null"u8;
9-
public static ReadOnlySpan<byte> EscapedNull => "\\\\null"u8;
8+
public static ReadOnlySpan<byte> Null => @"\null"u8;
9+
public static ReadOnlySpan<byte> EscapedNull => @"\\null"u8;
1010

11-
public static ReadOnlySpan<byte> EscapedColon => "\\:"u8;
11+
public static ReadOnlySpan<byte> EscapedColon => @"\:"u8;
1212

1313
public static object? Parse(ReadOnlySpan<byte> formattedKey, ICursorKeySerializer serializer)
1414
{

src/GreenDonut/test/GreenDonut.Data.Tests/Cursors/CursorFormatterTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public void Format_Two_Keys_With_Colon()
7979

8080
// assert
8181
Assert.Equal("e310ZXN0XDozNDU6ZGVzY3JpcHRpb25cOjEyMw==", result);
82-
Assert.Equal("{}test\\:345:description\\:123", Encoding.UTF8.GetString(Convert.FromBase64String(result)));
82+
Assert.Equal(@"{}test\:345:description\:123", Encoding.UTF8.GetString(Convert.FromBase64String(result)));
8383
}
8484

8585
[Fact]

src/HotChocolate/Language/test/Language.Tests/Parser/Utf8HelperTests.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ public void Unescape_LongStringWithEscapeAtEnd()
212212
public void Unescape_MultipleEscapesInLongString()
213213
{
214214
// arrange - multiple escapes spread across SIMD boundaries
215-
var inputData = "ABCDEFGHIJ\\nKLMNOPQRSTUVWXYZ\\tabcdefghij\\rklmnopqrstuvwxyz"u8.ToArray();
215+
var inputData = @"ABCDEFGHIJ\nKLMNOPQRSTUVWXYZ\tabcdefghij\rklmnopqrstuvwxyz"u8.ToArray();
216216
var outputBuffer = new byte[inputData.Length];
217217

218218
var input = new ReadOnlySpan<byte>(inputData);
@@ -230,7 +230,7 @@ public void Unescape_MultipleEscapesInLongString()
230230
public void Unescape_SurrogatePair_Emoji()
231231
{
232232
// arrange - surrogate pair for 😀 (U+1F600) = \uD83D\uDE00
233-
var inputData = "hello\\uD83D\\uDE00world"u8.ToArray();
233+
var inputData = @"hello\uD83D\uDE00world"u8.ToArray();
234234
var outputBuffer = new byte[inputData.Length];
235235

236236
var input = new ReadOnlySpan<byte>(inputData);
@@ -247,7 +247,7 @@ public void Unescape_SurrogatePair_Emoji()
247247
public void Unescape_ConsecutiveEscapes()
248248
{
249249
// arrange - multiple escapes in a row
250-
var inputData = "\\n\\r\\t\\b"u8.ToArray();
250+
var inputData = @"\n\r\t\b"u8.ToArray();
251251
var outputBuffer = new byte[inputData.Length];
252252

253253
var input = new ReadOnlySpan<byte>(inputData);
@@ -300,7 +300,7 @@ public void Unescape_Exactly16Bytes_NoEscape()
300300
public void Unescape_ForwardSlash()
301301
{
302302
// arrange - forward slash escape
303-
var inputData = "path\\/to\\/file"u8.ToArray();
303+
var inputData = @"path\/to\/file"u8.ToArray();
304304
var outputBuffer = new byte[inputData.Length];
305305

306306
var input = new ReadOnlySpan<byte>(inputData);
@@ -317,7 +317,7 @@ public void Unescape_ForwardSlash()
317317
public void Unescape_BackslashEscape()
318318
{
319319
// arrange - escaped backslash
320-
var inputData = "path\\\\to\\\\file"u8.ToArray();
320+
var inputData = @"path\\to\\file"u8.ToArray();
321321
var outputBuffer = new byte[inputData.Length];
322322

323323
var input = new ReadOnlySpan<byte>(inputData);
@@ -327,7 +327,7 @@ public void Unescape_BackslashEscape()
327327
Utf8Helper.Unescape(in input, ref output, false);
328328

329329
// assert
330-
Assert.Equal("path\\to\\file", Encoding.UTF8.GetString(output.ToArray()));
330+
Assert.Equal(@"path\to\file", Encoding.UTF8.GetString(output.ToArray()));
331331
}
332332

333333
[Fact]
@@ -457,7 +457,7 @@ public void Unescape_TruncatedUnicodeEscape_ThrowsException()
457457
public void Unescape_UnexpectedHighSurrogate_ThrowsException()
458458
{
459459
// arrange - two high surrogates in a row
460-
var inputData = "\\uD83D\\uD83D"u8.ToArray();
460+
var inputData = @"\uD83D\uD83D"u8.ToArray();
461461
var outputBuffer = new byte[inputData.Length];
462462

463463
// act & assert
@@ -487,7 +487,7 @@ public void Unescape_UnexpectedLowSurrogate_ThrowsException()
487487
public void Unescape_HighSurrogateNotFollowedByLowSurrogate_ThrowsException()
488488
{
489489
// arrange - high surrogate followed by regular char
490-
var inputData = "\\uD83D\\u0041"u8.ToArray();
490+
var inputData = @"\uD83D\u0041"u8.ToArray();
491491
var outputBuffer = new byte[inputData.Length];
492492

493493
// act & assert

0 commit comments

Comments
 (0)