remove redundant test_ prefix

This commit is contained in:
Damien Elmes 2020-02-13 09:10:52 +10:00
parent 23483b0a57
commit ee27711b65
8 changed files with 23 additions and 23 deletions

View file

@ -145,7 +145,7 @@ mod test {
use std::collections::HashSet; use std::collections::HashSet;
#[test] #[test]
fn test_cloze() { fn cloze() {
assert_eq!( assert_eq!(
cloze_numbers_in_string("test"), cloze_numbers_in_string("test"),
vec![].into_iter().collect::<HashSet<u16>>() vec![].into_iter().collect::<HashSet<u16>>()

View file

@ -245,7 +245,7 @@ mod test {
} }
#[test] #[test]
fn test_change_tracking() -> Result<()> { fn change_tracking() -> Result<()> {
let dir = tempdir()?; let dir = tempdir()?;
let media_dir = dir.path().join("media"); let media_dir = dir.path().join("media");
std::fs::create_dir(&media_dir)?; std::fs::create_dir(&media_dir)?;

View file

@ -361,7 +361,7 @@ mod test {
} }
#[test] #[test]
fn test_media_check() -> Result<()> { fn media_check() -> Result<()> {
let (_dir, mgr, col_path) = common_setup()?; let (_dir, mgr, col_path) = common_setup()?;
// add some test files // add some test files
@ -395,7 +395,7 @@ mod test {
} }
#[test] #[test]
fn test_unicode_normalization() -> Result<()> { fn unicode_normalization() -> Result<()> {
let (_dir, mgr, col_path) = common_setup()?; let (_dir, mgr, col_path) = common_setup()?;
fs::write(&mgr.media_folder.join("ぱぱ.jpg"), "nfd encoding")?; fs::write(&mgr.media_folder.join("ぱぱ.jpg"), "nfd encoding")?;

View file

@ -257,7 +257,7 @@ mod test {
use tempfile::NamedTempFile; use tempfile::NamedTempFile;
#[test] #[test]
fn test_database() -> Result<()> { fn database() -> Result<()> {
let db_file = NamedTempFile::new()?; let db_file = NamedTempFile::new()?;
let db_file_path = db_file.path().to_str().unwrap(); let db_file_path = db_file.path().to_str().unwrap();
let mut mgr = MediaManager::new("/dummy", db_file_path)?; let mut mgr = MediaManager::new("/dummy", db_file_path)?;

View file

@ -99,7 +99,7 @@ mod test {
use chrono::{FixedOffset, Local, TimeZone, Utc}; use chrono::{FixedOffset, Local, TimeZone, Utc};
#[test] #[test]
fn test_rollover() { fn rollover() {
assert_eq!(normalized_rollover_hour(4), 4); assert_eq!(normalized_rollover_hour(4), 4);
assert_eq!(normalized_rollover_hour(23), 23); assert_eq!(normalized_rollover_hour(23), 23);
assert_eq!(normalized_rollover_hour(24), 23); assert_eq!(normalized_rollover_hour(24), 23);
@ -110,7 +110,7 @@ mod test {
} }
#[test] #[test]
fn test_fixed_offset() { fn fixed_offset() {
let offset = fixed_offset_from_minutes(-600); let offset = fixed_offset_from_minutes(-600);
assert_eq!(offset.utc_minus_local(), -600 * 60); assert_eq!(offset.utc_minus_local(), -600 * 60);
} }
@ -125,14 +125,14 @@ mod test {
#[cfg(target_vendor = "apple")] #[cfg(target_vendor = "apple")]
/// On Linux, TZ needs to be set prior to the process being started to take effect, /// On Linux, TZ needs to be set prior to the process being started to take effect,
/// so we limit this test to Macs. /// so we limit this test to Macs.
fn test_local_minutes_west() { fn local_minutes_west() {
// -480 throughout the year // -480 throughout the year
std::env::set_var("TZ", "Australia/Perth"); std::env::set_var("TZ", "Australia/Perth");
assert_eq!(local_minutes_west_for_stamp(Utc::now().timestamp()), -480); assert_eq!(local_minutes_west_for_stamp(Utc::now().timestamp()), -480);
} }
#[test] #[test]
fn test_days_elapsed() { fn days_elapsed() {
let local_offset = local_minutes_west_for_stamp(Utc::now().timestamp()); let local_offset = local_minutes_west_for_stamp(Utc::now().timestamp());
let created_dt = FixedOffset::west(local_offset * 60) let created_dt = FixedOffset::west(local_offset * 60)
@ -221,7 +221,7 @@ mod test {
} }
#[test] #[test]
fn test_next_day_at() { fn next_day_at() {
let rollhour = 4; let rollhour = 4;
let crt = Local.ymd(2019, 1, 1).and_hms(2, 0, 0); let crt = Local.ymd(2019, 1, 1).and_hms(2, 0, 0);

View file

@ -547,7 +547,7 @@ mod test {
use std::iter::FromIterator; use std::iter::FromIterator;
#[test] #[test]
fn test_field_empty() { fn field_empty() {
assert_eq!(field_is_empty(""), true); assert_eq!(field_is_empty(""), true);
assert_eq!(field_is_empty(" "), true); assert_eq!(field_is_empty(" "), true);
assert_eq!(field_is_empty("x"), false); assert_eq!(field_is_empty("x"), false);
@ -558,7 +558,7 @@ mod test {
} }
#[test] #[test]
fn test_parsing() { fn parsing() {
let tmpl = PT::from_text("foo {{bar}} {{#baz}} quux {{/baz}}").unwrap(); let tmpl = PT::from_text("foo {{bar}} {{#baz}} quux {{/baz}}").unwrap();
assert_eq!( assert_eq!(
tmpl.0, tmpl.0,
@ -606,7 +606,7 @@ mod test {
} }
#[test] #[test]
fn test_nonempty() { fn nonempty() {
let fields = HashSet::from_iter(vec!["1", "3"].into_iter()); let fields = HashSet::from_iter(vec!["1", "3"].into_iter());
let mut tmpl = PT::from_text("{{2}}{{1}}").unwrap(); let mut tmpl = PT::from_text("{{2}}{{1}}").unwrap();
assert_eq!(tmpl.renders_with_fields(&fields), true); assert_eq!(tmpl.renders_with_fields(&fields), true);
@ -619,7 +619,7 @@ mod test {
} }
#[test] #[test]
fn test_requirements() { fn requirements() {
let field_map: FieldMap = vec!["a", "b"] let field_map: FieldMap = vec!["a", "b"]
.iter() .iter()
.enumerate() .enumerate()
@ -680,7 +680,7 @@ mod test {
} }
#[test] #[test]
fn test_alt_syntax() { fn alt_syntax() {
let input = " let input = "
{{=<% %>=}} {{=<% %>=}}
<%Front%> <%Front%>
@ -695,7 +695,7 @@ mod test {
} }
#[test] #[test]
fn test_render_single() { fn render_single() {
let map: HashMap<_, _> = vec![("F", "f"), ("B", "b"), ("E", " ")] let map: HashMap<_, _> = vec![("F", "f"), ("B", "b"), ("E", " ")]
.into_iter() .into_iter()
.collect(); .collect();

View file

@ -204,7 +204,7 @@ mod test {
use crate::text::strip_html; use crate::text::strip_html;
#[test] #[test]
fn test_furigana() { fn furigana() {
let text = "test first[second] third[fourth]"; let text = "test first[second] third[fourth]";
assert_eq!(kana_filter(text).as_ref(), "testsecondfourth"); assert_eq!(kana_filter(text).as_ref(), "testsecondfourth");
assert_eq!(kanji_filter(text).as_ref(), "testfirstthird"); assert_eq!(kanji_filter(text).as_ref(), "testfirstthird");
@ -215,7 +215,7 @@ mod test {
} }
#[test] #[test]
fn test_hint() { fn hint() {
assert_eq!( assert_eq!(
hint_filter("foo", "field"), hint_filter("foo", "field"),
r##" r##"
@ -230,7 +230,7 @@ field</a>
} }
#[test] #[test]
fn test_type() { fn typing() {
assert_eq!(type_filter("Front"), "[[type:Front]]"); assert_eq!(type_filter("Front"), "[[type:Front]]");
assert_eq!(type_cloze_filter("Front"), "[[type:cloze:Front]]"); assert_eq!(type_cloze_filter("Front"), "[[type:cloze:Front]]");
let ctx = RenderContext { let ctx = RenderContext {
@ -246,7 +246,7 @@ field</a>
} }
#[test] #[test]
fn test_cloze() { fn cloze() {
let text = "{{c1::one}} {{c2::two::hint}}"; let text = "{{c1::one}} {{c2::two::hint}}";
let mut ctx = RenderContext { let mut ctx = RenderContext {
fields: &Default::default(), fields: &Default::default(),
@ -274,7 +274,7 @@ field</a>
} }
#[test] #[test]
fn test_tts() { fn tts() {
assert_eq!( assert_eq!(
tts_filter("tts en_US voices=Bob,Jane", "foo"), tts_filter("tts en_US voices=Bob,Jane", "foo"),
"[anki:tts][en_US voices=Bob,Jane]foo[/anki:tts]" "[anki:tts][en_US voices=Bob,Jane]foo[/anki:tts]"

View file

@ -227,7 +227,7 @@ mod test {
}; };
#[test] #[test]
fn test_stripping() { fn stripping() {
assert_eq!(strip_html("test"), "test"); assert_eq!(strip_html("test"), "test");
assert_eq!(strip_html("t<b>e</b>st"), "test"); assert_eq!(strip_html("t<b>e</b>st"), "test");
assert_eq!(strip_html("so<SCRIPT>t<b>e</b>st</script>me"), "some"); assert_eq!(strip_html("so<SCRIPT>t<b>e</b>st</script>me"), "some");
@ -244,7 +244,7 @@ mod test {
} }
#[test] #[test]
fn test_audio() { fn audio() {
let s = let s =
"abc[sound:fo&amp;o.mp3]def[anki:tts][en_US voices=Bob,Jane speed=1.2]foo<br>1&gt;2[/anki:tts]gh"; "abc[sound:fo&amp;o.mp3]def[anki:tts][en_US voices=Bob,Jane speed=1.2]foo<br>1&gt;2[/anki:tts]gh";
assert_eq!(strip_av_tags(s), "abcdefgh"); assert_eq!(strip_av_tags(s), "abcdefgh");