summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorsharkdp <davidpeter@web.de>2019-02-10 09:19:38 +0100
committerDavid Peter <sharkdp@users.noreply.github.com>2019-02-10 10:18:07 +0100
commitfa3244f7c19431a386d8da02437e48cdb3b2f196 (patch)
tree7cb0a20870653b533570360afd6c294b27a91dc7 /tests
parent906774e6d3e55831a29f611757f609fba0717628 (diff)
Add test for UTF-16LE encoding
Diffstat (limited to 'tests')
-rw-r--r--tests/examples/test_UTF-16LE.txtbin0 -> 26 bytes
-rw-r--r--tests/integration_tests.rs12
2 files changed, 12 insertions, 0 deletions
diff --git a/tests/examples/test_UTF-16LE.txt b/tests/examples/test_UTF-16LE.txt
new file mode 100644
index 00000000..d43fec4c
--- /dev/null
+++ b/tests/examples/test_UTF-16LE.txt
Binary files differ
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());
+}