Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ pub struct Message {

/// Description part of the commit message.
pub description: Option<String>,

/// Footers part of the commit message.
pub footers: Option<HashMap<String, String>>,

#[allow(dead_code)]
/// Raw commit message (or any input from stdin) including the body and footers.
pub raw: String,

Expand Down
18 changes: 12 additions & 6 deletions src/rule/description_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ mod tests {

#[test]
fn test_invalid_description_format() {
let mut rule = DescriptionFormat::default();
rule.format = Some(r"^[a-z].*".to_string());
let rule = DescriptionFormat {
format: Some(r"^[a-z].*".to_string()),
..Default::default()
};

let message = Message {
body: None,
Expand All @@ -96,8 +98,10 @@ mod tests {

#[test]
fn test_valid_description_format() {
let mut rule = DescriptionFormat::default();
rule.format = Some(r"^[a-z].*".to_string());
let rule = DescriptionFormat {
format: Some(r"^[a-z].*".to_string()),
..Default::default()
};

let message = Message {
body: None,
Expand All @@ -120,8 +124,10 @@ mod tests {

#[test]
fn test_invalid_regex() {
let mut rule = DescriptionFormat::default();
rule.format = Some(r"(".to_string());
let rule = DescriptionFormat {
format: Some(r"(".to_string()),
..Default::default()
};

let message = Message {
body: None,
Expand Down
24 changes: 16 additions & 8 deletions src/rule/scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,10 @@ mod tests {
use super::*;
#[test]
fn test_empty_scope() {
let mut rule = Scope::default();
rule.options = vec!["api".to_string(), "web".to_string()];
let rule = Scope {
options: vec!["api".to_string(), "web".to_string()],
..Default::default()
};

let message = Message {
body: None,
Expand All @@ -164,8 +166,10 @@ mod tests {

#[test]
fn test_none_scope() {
let mut rule = Scope::default();
rule.options = vec!["api".to_string(), "web".to_string()];
let rule = Scope {
options: vec!["api".to_string(), "web".to_string()],
..Default::default()
};

let message = Message {
body: None,
Expand All @@ -188,8 +192,10 @@ mod tests {

#[test]
fn test_valid_scope() {
let mut rule = Scope::default();
rule.options = vec!["api".to_string(), "web".to_string()];
let rule = Scope {
options: vec!["api".to_string(), "web".to_string()],
..Default::default()
};

let message = Message {
body: None,
Expand All @@ -206,8 +212,10 @@ mod tests {

#[test]
fn test_invalid_scope() {
let mut rule = Scope::default();
rule.options = vec!["api".to_string(), "web".to_string()];
let rule = Scope {
options: vec!["api".to_string(), "web".to_string()],
..Default::default()
};

let message = Message {
body: None,
Expand Down
18 changes: 12 additions & 6 deletions src/rule/scope_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ mod tests {

#[test]
fn test_invalid_description_format() {
let mut rule = ScopeFormat::default();
rule.format = Some(r"^[a-z].*".to_string());
let rule = ScopeFormat {
format: Some(r"^[a-z].*".to_string()),
..Default::default()
};

let message = Message {
body: None,
Expand All @@ -96,8 +98,10 @@ mod tests {

#[test]
fn test_valid_description_format() {
let mut rule = ScopeFormat::default();
rule.format = Some(r"^[a-z].*".to_string());
let rule = ScopeFormat {
format: Some(r"^[a-z].*".to_string()),
..Default::default()
};

let message = Message {
body: None,
Expand All @@ -120,8 +124,10 @@ mod tests {

#[test]
fn test_invalid_regex() {
let mut rule = ScopeFormat::default();
rule.format = Some(r"(".to_string());
let rule = ScopeFormat {
format: Some(r"(".to_string()),
..Default::default()
};

let message = Message {
body: None,
Expand Down
24 changes: 16 additions & 8 deletions src/rule/type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,10 @@ mod tests {
use super::*;
#[test]
fn test_empty_type() {
let mut rule = Type::default();
rule.options = vec!["feat".to_string(), "chore".to_string()];
let rule = Type {
options: vec!["feat".to_string(), "chore".to_string()],
..Default::default()
};

let message = Message {
body: None,
Expand All @@ -163,8 +165,10 @@ mod tests {

#[test]
fn test_none_type() {
let mut rule = Type::default();
rule.options = vec!["feat".to_string(), "chore".to_string()];
let rule = Type {
options: vec!["feat".to_string(), "chore".to_string()],
..Default::default()
};

let message = Message {
body: None,
Expand All @@ -187,8 +191,10 @@ mod tests {

#[test]
fn test_valid_type() {
let mut rule = Type::default();
rule.options = vec!["feat".to_string(), "chore".to_string()];
let rule = Type {
options: vec!["feat".to_string(), "chore".to_string()],
..Default::default()
};

let message = Message {
body: None,
Expand All @@ -205,8 +211,10 @@ mod tests {

#[test]
fn test_invalid_type() {
let mut rule = Type::default();
rule.options = vec!["feat".to_string(), "chore".to_string()];
let rule = Type {
options: vec!["feat".to_string(), "chore".to_string()],
..Default::default()
};

let message = Message {
body: None,
Expand Down
18 changes: 12 additions & 6 deletions src/rule/type_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ mod tests {

#[test]
fn test_invalid_description_format() {
let mut rule = TypeFormat::default();
rule.format = Some(r"^[a-z].*".to_string());
let rule = TypeFormat {
format: Some(r"^[a-z].*".to_string()),
..Default::default()
};

let message = Message {
body: None,
Expand All @@ -96,8 +98,10 @@ mod tests {

#[test]
fn test_valid_description_format() {
let mut rule = TypeFormat::default();
rule.format = Some(r"^[a-z].*".to_string());
let rule = TypeFormat {
format: Some(r"^[a-z].*".to_string()),
..Default::default()
};

let message = Message {
body: None,
Expand All @@ -120,8 +124,10 @@ mod tests {

#[test]
fn test_invalid_regex() {
let mut rule = TypeFormat::default();
rule.format = Some(r"(".to_string());
let rule = TypeFormat {
format: Some(r"(".to_string()),
..Default::default()
};

let message = Message {
body: None,
Expand Down