Skip to content

Commit

Permalink
fix: add test
Browse files Browse the repository at this point in the history
  • Loading branch information
glihm committed Jul 25, 2024
1 parent ed596b1 commit c1d0aa5
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions crates/dojo-lang/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,23 @@ pub fn get_namespace_config(db: &dyn SyntaxGroup) -> Result<NamespaceConfig> {
// need it. This only concern the tests.
Ok(NamespaceConfig { default: "__NO_NAMESPACE__".into(), mappings: None })
}

Check warning on line 81 in crates/dojo-lang/src/utils.rs

View check run for this annotation

Codecov / codecov/patch

crates/dojo-lang/src/utils.rs#L80-L81

Added lines #L80 - L81 were not covered by tests

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

#[test]
fn test_is_name_valid() {
assert!(is_name_valid("valid_name"));
assert!(is_name_valid("ValidName"));
assert!(is_name_valid("valid123"));
assert!(is_name_valid("_valid"));
assert!(is_name_valid("valid_"));

assert!(!is_name_valid(""));
assert!(!is_name_valid("invalid-name"));
assert!(!is_name_valid("invalid name"));
assert!(!is_name_valid("invalid!name"));
assert!(!is_name_valid("invalid.name"));
}
}

0 comments on commit c1d0aa5

Please sign in to comment.