Skip to content

Commit

Permalink
chore: test for stripping bom
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed May 27, 2024
1 parent 73c54e7 commit 68bd43e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/format_text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}

0 comments on commit 68bd43e

Please sign in to comment.