mirror of
https://github.com/gitui-org/gitui
synced 2026-05-23 00:48:35 +00:00
add tests for commitChar filtering (#2151)
adds missing tests for b15c8643c8 (see #2145)
This commit is contained in:
parent
8272b20913
commit
92e0face1e
1 changed files with 38 additions and 1 deletions
|
|
@ -211,7 +211,7 @@ mod tests {
|
|||
utils::get_head,
|
||||
LogWalker,
|
||||
};
|
||||
use commit::{amend, tag_commit};
|
||||
use commit::{amend, commit_message_prettify, tag_commit};
|
||||
use git2::Repository;
|
||||
use std::{fs::File, io::Write, path::Path};
|
||||
|
||||
|
|
@ -463,4 +463,41 @@ mod tests {
|
|||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_empty_comment_char() -> Result<()> {
|
||||
let (_td, repo) = repo_init_empty().unwrap();
|
||||
|
||||
let root = repo.path().parent().unwrap();
|
||||
let repo_path: &RepoPath =
|
||||
&root.as_os_str().to_str().unwrap().into();
|
||||
|
||||
let message = commit_message_prettify(
|
||||
repo_path,
|
||||
"#This is a test message\nTest".to_owned(),
|
||||
)?;
|
||||
|
||||
assert_eq!(message, "Test\n");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_with_comment_char() -> Result<()> {
|
||||
let (_td, repo) = repo_init_empty().unwrap();
|
||||
|
||||
let root = repo.path().parent().unwrap();
|
||||
let repo_path: &RepoPath =
|
||||
&root.as_os_str().to_str().unwrap().into();
|
||||
|
||||
repo.config()?.set_str("core.commentChar", ";")?;
|
||||
|
||||
let message = commit_message_prettify(
|
||||
repo_path,
|
||||
";This is a test message\nTest".to_owned(),
|
||||
)?;
|
||||
|
||||
assert_eq!(message, "Test\n");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue