Setting up to give FieldType a new function.
This commit is contained in:
parent
111635a61c
commit
a6e0868890
@ -19,9 +19,9 @@ pub struct StaticString {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl StaticString {
|
impl StaticString {
|
||||||
pub fn new(data: &str) -> FieldType {
|
pub fn new() -> FieldType {
|
||||||
FieldType::StaticString(Self {
|
FieldType::StaticString(Self {
|
||||||
data: data.to_string(),
|
data: "".to_string(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -38,13 +38,10 @@ mod staticstrings {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn create_static_string() {
|
fn create_static_string() {
|
||||||
let data = "fred";
|
let field = StaticString::new();
|
||||||
let field = StaticString::new(data);
|
|
||||||
assert!(
|
assert!(
|
||||||
field.to_string() == data,
|
field.to_string() == "",
|
||||||
"\n\nGot: {}\nWant: {}\n\n",
|
"New should return an empty string."
|
||||||
field.to_string(),
|
|
||||||
data
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -237,8 +237,8 @@ mod records {
|
|||||||
async fn update_fields() {
|
async fn update_fields() {
|
||||||
let rec = Record::new();
|
let rec = Record::new();
|
||||||
let name = "elephant";
|
let name = "elephant";
|
||||||
let data = "Something to remember.";
|
let data = "";
|
||||||
let sstr = StaticString::new(data);
|
let sstr = StaticString::new();
|
||||||
rec.update_field(name.to_string(), sstr).await;
|
rec.update_field(name.to_string(), sstr).await;
|
||||||
let output = rec.get_field(name).await.unwrap();
|
let output = rec.get_field(name).await.unwrap();
|
||||||
assert!(
|
assert!(
|
||||||
|
Loading…
Reference in New Issue
Block a user