Skip to content

Commit

Permalink
Add regression test for include_str! normalization
Browse files Browse the repository at this point in the history
  • Loading branch information
matklad committed Aug 15, 2019
1 parent 66dc08a commit 14bc998
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/test/ui/.gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
lexer-crlf-line-endings-string-literal-doc-comment.rs -text
trailing-carriage-return-in-string.rs -text
*.bin -text
2 changes: 2 additions & 0 deletions src/test/ui/include-macros/data.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This file starts with BOM.
Lines are separated by \r\n.
12 changes: 12 additions & 0 deletions src/test/ui/include-macros/normalization.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// run-pass

fn main() {
assert_eq!(
&include_bytes!("data.bin")[..],
&b"\xEF\xBB\xBFThis file starts with BOM.\r\nLines are separated by \\r\\n.\r\n"[..],
);
assert_eq!(
include_str!("data.bin"),
"\u{FEFF}This file starts with BOM.\r\nLines are separated by \\r\\n.\r\n",
);
}

0 comments on commit 14bc998

Please sign in to comment.