#[cfg(test)]
mod tests {
use console::strip_ansi_codes;
use crate::cli;
use crate::tests::ansi_test_utils::ansi_test_utils;
use crate::tests::integration_test_utils::integration_test_utils;
#[test]
fn test_added_file() {
let options = integration_test_utils::get_command_line_options();
let (output, _) = integration_test_utils::run_delta(ADDED_FILE_INPUT, options);
let output = strip_ansi_codes(&output);
assert!(output.contains("\nadded: a.py\n"));
if false {
// TODO: hline width
assert_eq!(output, ADDED_FILE_EXPECTED_OUTPUT);
}
}
#[test]
#[ignore] // #128
fn test_added_empty_file() {
let options = integration_test_utils::get_command_line_options();
let (output, _) = integration_test_utils::run_delta(ADDED_EMPTY_FILE, options);
let output = strip_ansi_codes(&output);
assert!(output.contains("\nadded: file\n"));
}
#[test]
fn test_added_file_directory_path_containing_space() {
let options = integration_test_utils::get_command_line_options();
let (output, _) =
integration_test_utils::run_delta(ADDED_FILES_DIRECTORY_PATH_CONTAINING_SPACE, options);
let output = strip_ansi_codes(&output);
assert!(output.contains("\nadded: with space/file1\n"));
assert!(output.contains("\nadded: nospace/file2\n"));
}
#[test]
fn test_renamed_file() {
let options = integration_test_utils::get_command_line_options();
let (output, _) = integration_test_utils::run_delta(RENAMED_FILE_INPUT, options);
let output = strip_ansi_codes(&output);
assert!(output.contains("\nrenamed: a.py ⟶ b.py\n"));
}
#[test]
fn test_recognized_file_type() {
// In addition to the background color, the code has language syntax highlighting.
let options = integration_test_utils::get_command_line_options();
let (output, config) = integration_test_utils::get_line_of_code_from_delta(
<