Skip to content

Commit 52febe9

Browse files
committed
Add a few more tests for indents inside strings
1 parent d6b1739 commit 52febe9

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

rust-mode-tests.el

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,3 +1290,39 @@ And another line not indented
12901290
\")
12911291
}
12921292
"))
1293+
1294+
(ert-deftest test-indent-string-eol-backslash-dont-touch-raw-strings ()
1295+
(test-indent
1296+
"
1297+
pub fn foo() {
1298+
format!(r\"\
1299+
abc\
1300+
def\");
1301+
}
1302+
1303+
pub fn foo() {
1304+
format!(r\"la la la
1305+
la\
1306+
la la\");
1307+
}
1308+
"
1309+
;; Should still indent the code parts but leave the string internals alone:
1310+
"
1311+
pub fn foo() {
1312+
format!(r\"\
1313+
abc\
1314+
def\");
1315+
}
1316+
1317+
pub fn foo() {
1318+
format!(r\"la la la
1319+
la\
1320+
la la\");
1321+
}
1322+
"
1323+
))
1324+
1325+
(ert-deftest indent-inside-string-first-line ()
1326+
(test-indent
1327+
;; Needs to leave 1 space before "world"
1328+
"\"hello \\\n world\""))

0 commit comments

Comments
 (0)