Setting up to give FieldType a new function.

This commit is contained in:
Jeff Baskin 2022-07-21 09:26:23 -04:00
parent 111635a61c
commit a6e0868890
2 changed files with 7 additions and 10 deletions

View File

@ -19,9 +19,9 @@ pub struct StaticString {
}
impl StaticString {
pub fn new(data: &str) -> FieldType {
pub fn new() -> FieldType {
FieldType::StaticString(Self {
data: data.to_string(),
data: "".to_string(),
})
}
}
@ -38,13 +38,10 @@ mod staticstrings {
#[test]
fn create_static_string() {
let data = "fred";
let field = StaticString::new(data);
let field = StaticString::new();
assert!(
field.to_string() == data,
"\n\nGot: {}\nWant: {}\n\n",
field.to_string(),
data
field.to_string() == "",
"New should return an empty string."
);
}
}

View File

@ -237,8 +237,8 @@ mod records {
async fn update_fields() {
let rec = Record::new();
let name = "elephant";
let data = "Something to remember.";
let sstr = StaticString::new(data);
let data = "";
let sstr = StaticString::new();
rec.update_field(name.to_string(), sstr).await;
let output = rec.get_field(name).await.unwrap();
assert!(