Skip to content

Commit 14bc998

Browse files
committed
Add regression test for include_str! normalization
1 parent 66dc08a commit 14bc998

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

src/test/ui/.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
lexer-crlf-line-endings-string-literal-doc-comment.rs -text
22
trailing-carriage-return-in-string.rs -text
3+
*.bin -text

src/test/ui/include-macros/data.bin

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This file starts with BOM.
2+
Lines are separated by \r\n.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// run-pass
2+
3+
fn main() {
4+
assert_eq!(
5+
&include_bytes!("data.bin")[..],
6+
&b"\xEF\xBB\xBFThis file starts with BOM.\r\nLines are separated by \\r\\n.\r\n"[..],
7+
);
8+
assert_eq!(
9+
include_str!("data.bin"),
10+
"\u{FEFF}This file starts with BOM.\r\nLines are separated by \\r\\n.\r\n",
11+
);
12+
}

0 commit comments

Comments
 (0)