Setting up to give FieldType a new function.
This commit is contained in:
		@@ -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."
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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!(
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user