mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
remove redundant test_ prefix
This commit is contained in:
parent
23483b0a57
commit
ee27711b65
8 changed files with 23 additions and 23 deletions
|
@ -145,7 +145,7 @@ mod test {
|
|||
use std::collections::HashSet;
|
||||
|
||||
#[test]
|
||||
fn test_cloze() {
|
||||
fn cloze() {
|
||||
assert_eq!(
|
||||
cloze_numbers_in_string("test"),
|
||||
vec![].into_iter().collect::<HashSet<u16>>()
|
||||
|
|
|
@ -245,7 +245,7 @@ mod test {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_change_tracking() -> Result<()> {
|
||||
fn change_tracking() -> Result<()> {
|
||||
let dir = tempdir()?;
|
||||
let media_dir = dir.path().join("media");
|
||||
std::fs::create_dir(&media_dir)?;
|
||||
|
|
|
@ -361,7 +361,7 @@ mod test {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_media_check() -> Result<()> {
|
||||
fn media_check() -> Result<()> {
|
||||
let (_dir, mgr, col_path) = common_setup()?;
|
||||
|
||||
// add some test files
|
||||
|
@ -395,7 +395,7 @@ mod test {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_unicode_normalization() -> Result<()> {
|
||||
fn unicode_normalization() -> Result<()> {
|
||||
let (_dir, mgr, col_path) = common_setup()?;
|
||||
|
||||
fs::write(&mgr.media_folder.join("ぱぱ.jpg"), "nfd encoding")?;
|
||||
|
|
|
@ -257,7 +257,7 @@ mod test {
|
|||
use tempfile::NamedTempFile;
|
||||
|
||||
#[test]
|
||||
fn test_database() -> Result<()> {
|
||||
fn database() -> Result<()> {
|
||||
let db_file = NamedTempFile::new()?;
|
||||
let db_file_path = db_file.path().to_str().unwrap();
|
||||
let mut mgr = MediaManager::new("/dummy", db_file_path)?;
|
||||
|
|
|
@ -99,7 +99,7 @@ mod test {
|
|||
use chrono::{FixedOffset, Local, TimeZone, Utc};
|
||||
|
||||
#[test]
|
||||
fn test_rollover() {
|
||||
fn rollover() {
|
||||
assert_eq!(normalized_rollover_hour(4), 4);
|
||||
assert_eq!(normalized_rollover_hour(23), 23);
|
||||
assert_eq!(normalized_rollover_hour(24), 23);
|
||||
|
@ -110,7 +110,7 @@ mod test {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_fixed_offset() {
|
||||
fn fixed_offset() {
|
||||
let offset = fixed_offset_from_minutes(-600);
|
||||
assert_eq!(offset.utc_minus_local(), -600 * 60);
|
||||
}
|
||||
|
@ -125,14 +125,14 @@ mod test {
|
|||
#[cfg(target_vendor = "apple")]
|
||||
/// On Linux, TZ needs to be set prior to the process being started to take effect,
|
||||
/// so we limit this test to Macs.
|
||||
fn test_local_minutes_west() {
|
||||
fn local_minutes_west() {
|
||||
// -480 throughout the year
|
||||
std::env::set_var("TZ", "Australia/Perth");
|
||||
assert_eq!(local_minutes_west_for_stamp(Utc::now().timestamp()), -480);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_days_elapsed() {
|
||||
fn days_elapsed() {
|
||||
let local_offset = local_minutes_west_for_stamp(Utc::now().timestamp());
|
||||
|
||||
let created_dt = FixedOffset::west(local_offset * 60)
|
||||
|
@ -221,7 +221,7 @@ mod test {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_next_day_at() {
|
||||
fn next_day_at() {
|
||||
let rollhour = 4;
|
||||
let crt = Local.ymd(2019, 1, 1).and_hms(2, 0, 0);
|
||||
|
||||
|
|
|
@ -547,7 +547,7 @@ mod test {
|
|||
use std::iter::FromIterator;
|
||||
|
||||
#[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("x"), false);
|
||||
|
@ -558,7 +558,7 @@ mod test {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_parsing() {
|
||||
fn parsing() {
|
||||
let tmpl = PT::from_text("foo {{bar}} {{#baz}} quux {{/baz}}").unwrap();
|
||||
assert_eq!(
|
||||
tmpl.0,
|
||||
|
@ -606,7 +606,7 @@ mod test {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_nonempty() {
|
||||
fn nonempty() {
|
||||
let fields = HashSet::from_iter(vec!["1", "3"].into_iter());
|
||||
let mut tmpl = PT::from_text("{{2}}{{1}}").unwrap();
|
||||
assert_eq!(tmpl.renders_with_fields(&fields), true);
|
||||
|
@ -619,7 +619,7 @@ mod test {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_requirements() {
|
||||
fn requirements() {
|
||||
let field_map: FieldMap = vec!["a", "b"]
|
||||
.iter()
|
||||
.enumerate()
|
||||
|
@ -680,7 +680,7 @@ mod test {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_alt_syntax() {
|
||||
fn alt_syntax() {
|
||||
let input = "
|
||||
{{=<% %>=}}
|
||||
<%Front%>
|
||||
|
@ -695,7 +695,7 @@ mod test {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_render_single() {
|
||||
fn render_single() {
|
||||
let map: HashMap<_, _> = vec![("F", "f"), ("B", "b"), ("E", " ")]
|
||||
.into_iter()
|
||||
.collect();
|
||||
|
|
|
@ -204,7 +204,7 @@ mod test {
|
|||
use crate::text::strip_html;
|
||||
|
||||
#[test]
|
||||
fn test_furigana() {
|
||||
fn furigana() {
|
||||
let text = "test first[second] third[fourth]";
|
||||
assert_eq!(kana_filter(text).as_ref(), "testsecondfourth");
|
||||
assert_eq!(kanji_filter(text).as_ref(), "testfirstthird");
|
||||
|
@ -215,7 +215,7 @@ mod test {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_hint() {
|
||||
fn hint() {
|
||||
assert_eq!(
|
||||
hint_filter("foo", "field"),
|
||||
r##"
|
||||
|
@ -230,7 +230,7 @@ field</a>
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_type() {
|
||||
fn typing() {
|
||||
assert_eq!(type_filter("Front"), "[[type:Front]]");
|
||||
assert_eq!(type_cloze_filter("Front"), "[[type:cloze:Front]]");
|
||||
let ctx = RenderContext {
|
||||
|
@ -246,7 +246,7 @@ field</a>
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_cloze() {
|
||||
fn cloze() {
|
||||
let text = "{{c1::one}} {{c2::two::hint}}";
|
||||
let mut ctx = RenderContext {
|
||||
fields: &Default::default(),
|
||||
|
@ -274,7 +274,7 @@ field</a>
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_tts() {
|
||||
fn tts() {
|
||||
assert_eq!(
|
||||
tts_filter("tts en_US voices=Bob,Jane", "foo"),
|
||||
"[anki:tts][en_US voices=Bob,Jane]foo[/anki:tts]"
|
||||
|
|
|
@ -227,7 +227,7 @@ mod test {
|
|||
};
|
||||
|
||||
#[test]
|
||||
fn test_stripping() {
|
||||
fn stripping() {
|
||||
assert_eq!(strip_html("test"), "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");
|
||||
|
@ -244,7 +244,7 @@ mod test {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_audio() {
|
||||
fn audio() {
|
||||
let s =
|
||||
"abc[sound:fo&o.mp3]def[anki:tts][en_US voices=Bob,Jane speed=1.2]foo<br>1>2[/anki:tts]gh";
|
||||
assert_eq!(strip_av_tags(s), "abcdefgh");
|
||||
|
|
Loading…
Reference in a new issue