From 6be28381d6081dfb3a1dc9d1ec15062b67ba1ef9 Mon Sep 17 00:00:00 2001 From: Tolmachev Igor Date: Sat, 9 May 2026 19:04:27 +0300 Subject: Implement fmt::Display for Error Replaces the todo!() stub. InvalidFloatLiteral and InvalidIntegerLiteral now also take the original string. --- compiler/src/ast/tests.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'compiler/src/ast/tests.rs') diff --git a/compiler/src/ast/tests.rs b/compiler/src/ast/tests.rs index 708e788..c6d8c38 100644 --- a/compiler/src/ast/tests.rs +++ b/compiler/src/ast/tests.rs @@ -415,7 +415,7 @@ fn test_invalid_integer() { let error = number.parse::().unwrap_err(); assert_eq!( parse_err(tokens.clone()), - Error::InvalidIntegerLiteral(error), + Error::InvalidIntegerLiteral(number.into(), error), "input: {tokens:?}", ); } @@ -445,7 +445,7 @@ fn test_invalid_float() { let error = number.parse::().unwrap_err(); assert_eq!( parse_err(tokens.clone()), - Error::InvalidFloatLiteral(error), + Error::InvalidFloatLiteral(number.into(), error), "input: {tokens:?}", ); } @@ -639,7 +639,7 @@ fn test_error_span_invalid_float() { let err = parse_sp_err(tokens.clone()); assert!( - matches!(err.inner, Error::InvalidFloatLiteral(_)), + matches!(err.inner, Error::InvalidFloatLiteral(..)), "input: {tokens:?}, got: {:?}", err.inner, ); @@ -725,7 +725,7 @@ fn test_error_span_deep_nested() { let err = parse_sp_err(tokens.clone()); assert!( - matches!(err.inner, Error::InvalidIntegerLiteral(_)), + matches!(err.inner, Error::InvalidIntegerLiteral(..)), "input: {tokens:?}, got: {:?}", err.inner, ); -- cgit v1.3