Added additional response error.
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				MoreThanText/morethantext/pipeline/head This commit looks good
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	MoreThanText/morethantext/pipeline/head This commit looks good
				
			This commit is contained in:
		
							
								
								
									
										18
									
								
								src/lib.rs
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								src/lib.rs
									
									
									
									
									
								
							@@ -156,6 +156,9 @@ impl Response {
 | 
			
		||||
                self.data.insert(key.to_string(), store);
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            if rec.len() != self.data.len() {
 | 
			
		||||
                return Err("incorrect number of columns".to_string());
 | 
			
		||||
            }
 | 
			
		||||
            for (key, value) in rec.iter() {
 | 
			
		||||
                match self.data.get_mut(key) {
 | 
			
		||||
                    Some(data) => data.push(value.clone()),
 | 
			
		||||
@@ -244,6 +247,21 @@ mod responses {
 | 
			
		||||
            Err(_) => {}
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    #[test]
 | 
			
		||||
    fn missing_field_error() {
 | 
			
		||||
        let mut res = Response::new();
 | 
			
		||||
        let mut rec1 = Record::new();
 | 
			
		||||
        let mut rec2 = Record::new();
 | 
			
		||||
        rec1.add("one", "one");
 | 
			
		||||
        rec2.add("one", "one");
 | 
			
		||||
        rec2.add("two", "two");
 | 
			
		||||
        res.add(rec2).unwrap();
 | 
			
		||||
        match res.add(rec1) {
 | 
			
		||||
            Ok(_) => unreachable!("Should not accept additional value"),
 | 
			
		||||
            Err(_) => {}
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Support functions for Messages.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user