From 68bd43eff91531662de025e2acdbff81f62284e2 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Sun, 26 May 2024 23:46:35 -0400 Subject: [PATCH] chore: test for stripping bom --- src/format_text.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/format_text.rs b/src/format_text.rs index c447b33..ec74151 100644 --- a/src/format_text.rs +++ b/src/format_text.rs @@ -60,3 +60,15 @@ fn resolve_options(file_path: &Path, config: &Configuration) -> PyFormatOptions } options } + +#[cfg(test)] +mod test { + #[test] + fn strips_bom() { + let input = "\u{FEFF}print('hello')"; + let config = crate::configuration::Configuration::default(); + let file_path = std::path::Path::new("test.py"); + let result = super::format_text(file_path, input, &config).unwrap().unwrap(); + assert_eq!(result, "print(\"hello\")\n"); + } +}