Skip to content

Commit

Permalink
Add tests for extended_category_name
Browse files Browse the repository at this point in the history
  • Loading branch information
wooferzfg committed Jan 19, 2021
1 parent f1d004c commit da38fa9
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
50 changes: 50 additions & 0 deletions src/run/tests/extended_category_name.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
use crate::run::Run;

#[test]
fn no_parentheses() {
let mut run = Run::new();
run.set_category_name("100% Speedrun");

let name = run.extended_category_name(false, false, false).to_string();
assert_eq!(name, "100% Speedrun");
}

#[test]
fn ends_with_parentheses() {
let mut run = Run::new();
run.set_category_name("Any% (No Tuner)");

let name = run.extended_category_name(false, false, false).to_string();
assert_eq!(name, "Any% (No Tuner)");
}

#[test]
fn has_parentheses() {
let mut run = Run::new();
run.set_category_name("Any% (Tuner) Speedrun");

let name = run.extended_category_name(false, false, false).to_string();
assert_eq!(name, "Any% (Tuner) Speedrun");
}

#[test]
fn no_parentheses_with_additional_info() {
let mut run = Run::new();
run.set_category_name("100% Speedrun");
let metadata = run.metadata_mut();
metadata.set_region_name("REGION");

let name = run.extended_category_name(true, false, false).to_string();
assert_eq!(name, "100% Speedrun (REGION)");
}

#[test]
fn has_parentheses_with_additional_info() {
let mut run = Run::new();
run.set_category_name("Any% (Tuner) Speedrun");
let metadata = run.metadata_mut();
metadata.set_region_name("REGION");

let name = run.extended_category_name(true, false, false).to_string();
assert_eq!(name, "Any% (Tuner, REGION) Speedrun");
}
1 change: 1 addition & 0 deletions src/run/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
mod comparison;
mod empty_run;
mod extended_category_name;
mod fixing;
mod metadata;

0 comments on commit da38fa9

Please sign in to comment.