From 7b27dcdd625cc24834ccc706909eaaf6d52a1c34 Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Wed, 11 Nov 2020 13:25:45 +0800 Subject: [PATCH] Fix error messages. --- src/packages/array_basic.rs | 16 ++++++++-------- tests/fn_ptr.rs | 3 ++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/packages/array_basic.rs b/src/packages/array_basic.rs index 63abbf48..339c4c94 100644 --- a/src/packages/array_basic.rs +++ b/src/packages/array_basic.rs @@ -281,7 +281,7 @@ mod array_functions { }) .map_err(|err| { Box::new(EvalAltResult::ErrorInFunctionCall( - "filter".to_string(), + "index_of".to_string(), err, NO_POS, )) @@ -314,7 +314,7 @@ mod array_functions { }) .map_err(|err| { Box::new(EvalAltResult::ErrorInFunctionCall( - "filter".to_string(), + "some".to_string(), err, NO_POS, )) @@ -347,7 +347,7 @@ mod array_functions { }) .map_err(|err| { Box::new(EvalAltResult::ErrorInFunctionCall( - "filter".to_string(), + "all".to_string(), err, NO_POS, )) @@ -449,7 +449,7 @@ mod array_functions { }) .map_err(|err| { Box::new(EvalAltResult::ErrorInFunctionCall( - "reduce".to_string(), + "reduce_rev".to_string(), err, NO_POS, )) @@ -467,7 +467,7 @@ mod array_functions { ) -> Result> { let mut result = initial.call_dynamic(ctx, None, []).map_err(|err| { Box::new(EvalAltResult::ErrorInFunctionCall( - "reduce".to_string(), + "reduce_rev".to_string(), err, NO_POS, )) @@ -486,7 +486,7 @@ mod array_functions { }) .map_err(|err| { Box::new(EvalAltResult::ErrorInFunctionCall( - "reduce".to_string(), + "reduce_rev".to_string(), err, NO_POS, )) @@ -556,7 +556,7 @@ mod array_functions { }) .map_err(|err| { Box::new(EvalAltResult::ErrorInFunctionCall( - "filter".to_string(), + "drain".to_string(), err, NO_POS, )) @@ -615,7 +615,7 @@ mod array_functions { }) .map_err(|err| { Box::new(EvalAltResult::ErrorInFunctionCall( - "filter".to_string(), + "retain".to_string(), err, NO_POS, )) diff --git a/tests/fn_ptr.rs b/tests/fn_ptr.rs index c6658f17..6a37af62 100644 --- a/tests/fn_ptr.rs +++ b/tests/fn_ptr.rs @@ -73,7 +73,8 @@ fn test_fn_ptr() -> Result<(), Box> { "# ) .expect_err("should error"), - EvalAltResult::ErrorInFunctionCall(fn_name, err, _) if fn_name == "foo" && matches!(*err, EvalAltResult::ErrorUnboundThis(_)) + EvalAltResult::ErrorInFunctionCall(fn_name, err, _) + if fn_name == "foo" && matches!(*err, EvalAltResult::ErrorUnboundThis(_)) )); Ok(())