From fa3244f7c19431a386d8da02437e48cdb3b2f196 Mon Sep 17 00:00:00 2001 From: sharkdp Date: Sun, 10 Feb 2019 09:19:38 +0100 Subject: [PATCH] Add test for UTF-16LE encoding --- tests/examples/test_UTF-16LE.txt | Bin 0 -> 26 bytes tests/integration_tests.rs | 12 ++++++++++++ 2 files changed, 12 insertions(+) create mode 100644 tests/examples/test_UTF-16LE.txt diff --git a/tests/examples/test_UTF-16LE.txt b/tests/examples/test_UTF-16LE.txt new file mode 100644 index 0000000000000000000000000000000000000000..d43fec4cfad56012bb45b7c6a62ad9d42d72349e GIT binary patch literal 26 dcmezWFM}bKAqNQa859`Gfn*Voox;Gy003{A24nyL literal 0 HcmV?d00001 diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index c0c282e3..7d9856ac 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -436,3 +436,15 @@ fn config_read_arguments_from_file() { .success() .stdout("dummy-pager-from-config\n"); } + +#[test] +fn utf16() { + // The output will be converted to UTF-8 with a leading UTF-8 BOM + bat() + .arg("--plain") + .arg("--decorations=always") + .arg("test_UTF-16LE.txt") + .assert() + .success() + .stdout(std::str::from_utf8(b"\xEF\xBB\xBFhello world\n").unwrap()); +}