Skip to content

Commit

Permalink
Add more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
sorami committed Feb 27, 2024
1 parent 29c047d commit 79ceddf
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions nusamai/src/transformer/transform/attrname.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,13 @@ mod tests {
fn test_rename() {
let mut transform = EditFieldNamesTransform::new();
let mut map = HashMap::new();
map.insert("old_name".to_string(), "new_name".to_string());
map.insert("*:attr1".to_string(), "atrr1_new".to_string());
map.insert("bldg:attr1".to_string(), "atrr1_bldg".to_string());
transform.extend_rename_map(map);

assert_eq!(transform.rename("ns:old_name"), Some("new_name"));
assert_eq!(transform.rename("ns:old_name2"), Some("old_name2"));
assert_eq!(transform.rename("namespace:foo"), Some("foo")); // ns removed
assert_eq!(transform.rename("namespace:attr1"), Some("attr1_new"));
assert_eq!(transform.rename("veg:attr1"), Some("attr1_new"));
assert_eq!(transform.rename("bldg:attr1"), Some("atrr1_bldg"));
}
}

0 comments on commit 79ceddf

Please sign in to comment.