From fc91e2cd8b80a6d19d91bdc1034b34ce3283a6d1 Mon Sep 17 00:00:00 2001 From: Jeff Baskin Date: Sun, 24 Jul 2022 23:11:33 -0400 Subject: [PATCH] Refactor tests. --- src/morethantext/fieldtype.rs | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/morethantext/fieldtype.rs b/src/morethantext/fieldtype.rs index 07de4f3..e47e7b9 100644 --- a/src/morethantext/fieldtype.rs +++ b/src/morethantext/fieldtype.rs @@ -37,6 +37,24 @@ impl fmt::Display for StaticString { } } +#[cfg(test)] +mod fieldtypes { + use super::*; + + #[test] + fn convert_static_string() { + let data = "a static string"; + let field = StaticString::new(data); + let ftype: FieldType = field.into(); + assert!( + ftype.to_string() == data, + "\n\nGot: {}\nWant: {}", + ftype.to_string(), + data + ); + } +} + #[cfg(test)] mod staticstrings { use super::*; @@ -51,13 +69,6 @@ mod staticstrings { field.to_string(), data ); - let ftype: FieldType = field.into(); - assert!( - ftype.to_string() == data, - "\n\nGot: {}\nWant: {}", - ftype.to_string(), - data - ); } #[test]