Skip to content

Commit 0680a28

Browse files
committed
Adds test (currently failing) to show that a UTF-8 file with BOM is not parsed properly when read using FileSourceFile
1 parent 4b58d4b commit 0680a28

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"debug": true,
3+
"production": false
4+
}

tests/testsuite/file.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,18 @@ fn test_file_ext() {
6767
assert_eq!(c.get("production").ok(), Some(false));
6868
}
6969

70+
#[test]
71+
#[cfg(feature = "json")]
72+
fn test_file_ext_with_utf8_bom() {
73+
let c = Config::builder()
74+
.add_source(File::with_name("tests/testsuite/file-ext-with-bom.json"))
75+
.build()
76+
.unwrap();
77+
78+
assert_eq!(c.get("debug").ok(), Some(true));
79+
assert_eq!(c.get("production").ok(), Some(false));
80+
}
81+
7082
#[test]
7183
#[cfg(feature = "json")]
7284
fn test_file_second_ext() {

0 commit comments

Comments
 (0)