Use unwrap_err.

This commit is contained in:
Stephen Chung
2023-04-10 23:23:59 +08:00
parent 20c535ecd3
commit 8662ffec62
24 changed files with 100 additions and 153 deletions

View File

@@ -27,10 +27,7 @@ fn test_loop() -> Result<(), Box<EvalAltResult>> {
);
assert_eq!(
*engine
.compile("let x = 0; break;")
.expect_err("should error")
.err_type(),
*engine.compile("let x = 0; break;").unwrap_err().err_type(),
ParseErrorType::LoopBreak
);
@@ -38,7 +35,7 @@ fn test_loop() -> Result<(), Box<EvalAltResult>> {
assert_eq!(
*engine
.compile("loop { let f = || { break; } }")
.expect_err("should error")
.unwrap_err()
.err_type(),
ParseErrorType::LoopBreak
);
@@ -46,7 +43,7 @@ fn test_loop() -> Result<(), Box<EvalAltResult>> {
assert_eq!(
*engine
.compile("let x = 0; if x > 0 { continue; }")
.expect_err("should error")
.unwrap_err()
.err_type(),
ParseErrorType::LoopBreak
);