Skip to content

Commit 6d47322

Browse files
committed
add: tests for validate_field_names
1 parent 225c3e5 commit 6d47322

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/static_schema.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,23 @@ fn validate_field_names(field_name: &str, existing_fields: &mut HashSet<String>)
195195

196196
Ok(())
197197
}
198+
199+
#[cfg(test)]
200+
mod tests {
201+
use super::*;
202+
#[test]
203+
fn empty_field_names() {
204+
let mut existing_field_names: HashSet<String> = HashSet::new();
205+
assert!(validate_field_names("", &mut existing_field_names).is_err());
206+
207+
}
208+
209+
#[test]
210+
fn duplicate_field_names() {
211+
let mut existing_field_names: HashSet<String> = HashSet::new();
212+
let _ = validate_field_names("test_field", &mut existing_field_names);
213+
assert!(validate_field_names("test_field", &mut existing_field_names).is_err());
214+
}
215+
216+
217+
}

0 commit comments

Comments
 (0)