mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
zig fmt: properly check escape sequences
This commit is contained in:
parent
6bcd6b35ce
commit
8d4531bff5
2 changed files with 11 additions and 1 deletions
|
|
@ -3359,7 +3359,7 @@ fn renderIdentifier(r: *Render, token_index: Ast.TokenIndex, space: Space, quote
|
|||
},
|
||||
.failure => return renderQuotedIdentifier(r, token_index, space, false),
|
||||
}
|
||||
contents_i += esc_offset;
|
||||
contents_i = esc_offset;
|
||||
continue;
|
||||
},
|
||||
else => return renderQuotedIdentifier(r, token_index, space, false),
|
||||
|
|
|
|||
|
|
@ -6152,6 +6152,16 @@ test "zig fmt: seperate errors in error sets with comments" {
|
|||
);
|
||||
}
|
||||
|
||||
test "zig fmt: proper escape checks" {
|
||||
try testTransform(
|
||||
\\@"\x41\x42\!"
|
||||
\\
|
||||
,
|
||||
\\@"AB\\!"
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: field accesses on number literals" {
|
||||
try testCanonical(
|
||||
\\const a = 0xF .A;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue