mirror of
https://github.com/nushell/nushell.git
synced 2025-08-14 08:28:37 +02:00
Fix typos and use more idiomatic assertions (#7755)
I have changed `assert!(a == b)` calls to `assert_eq!(a, b)`, which give better error messages. Similarly for `assert!(a != b)` and `assert_ne!(a, b)`. Basically all instances were comparing primitives (string slices or integers), so there is no loss of generality from special-case macros, I have also fixed a number of typos in comments, variable names, and a few user-facing messages.
This commit is contained in:
@ -921,21 +921,21 @@ mod test {
|
||||
#[test]
|
||||
fn test_pattern_from_str() {
|
||||
assert!("a*b".parse::<Pattern>().unwrap().matches("a_b"));
|
||||
assert!("a/**b".parse::<Pattern>().unwrap_err().pos == 4);
|
||||
assert_eq!("a/**b".parse::<Pattern>().unwrap_err().pos, 4);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_wildcard_errors() {
|
||||
assert!(Pattern::new("a/**b").unwrap_err().pos == 4);
|
||||
assert!(Pattern::new("a/bc**").unwrap_err().pos == 3);
|
||||
assert!(Pattern::new("a/*****").unwrap_err().pos == 4);
|
||||
assert!(Pattern::new("a/b**c**d").unwrap_err().pos == 2);
|
||||
assert!(Pattern::new("a**b").unwrap_err().pos == 0);
|
||||
assert_eq!(Pattern::new("a/**b").unwrap_err().pos, 4);
|
||||
assert_eq!(Pattern::new("a/bc**").unwrap_err().pos, 3);
|
||||
assert_eq!(Pattern::new("a/*****").unwrap_err().pos, 4);
|
||||
assert_eq!(Pattern::new("a/b**c**d").unwrap_err().pos, 2);
|
||||
assert_eq!(Pattern::new("a**b").unwrap_err().pos, 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_glob_errors() {
|
||||
assert!(glob("a/**b").err().unwrap().pos == 4);
|
||||
assert_eq!(glob("a/**b").err().unwrap().pos, 4);
|
||||
}
|
||||
|
||||
// this test assumes that there is a /root directory and that
|
||||
|
Reference in New Issue
Block a user