Skip to content

Commit

Permalink
Add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
sorami committed Feb 27, 2024
1 parent dc69114 commit 29c047d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions nusamai/src/transformer/transform/attrname.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,19 @@ impl EditFieldNamesTransform {
}
}
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_rename() {
let mut transform = EditFieldNamesTransform::new();
let mut map = HashMap::new();
map.insert("old_name".to_string(), "new_name".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"));
}
}

0 comments on commit 29c047d

Please sign in to comment.