mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-27 19:09:47 +03:00
zig fmt: properly check escape sequences
This commit is contained in:
@@ -3167,7 +3167,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),
|
||||
|
||||
@@ -6086,6 +6086,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;
|
||||
|
||||
Reference in New Issue
Block a user