From 38c5dfdf1cfd2a9db208070c0172735a6462600d Mon Sep 17 00:00:00 2001 From: Barsik Date: Mon, 13 May 2024 19:51:26 +0300 Subject: [PATCH] Wrote a test that shows an issue related to value displaying The `try_cast` method on value is designed to convert user input strings into parsed values, such as lists of strings or numbers. However, when converting these parsed values back into their original string representations using the `display` method, the resulting string may not match the original user input. --- module/move/wca/tests/inc/grammar/types.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/module/move/wca/tests/inc/grammar/types.rs b/module/move/wca/tests/inc/grammar/types.rs index 3278869eb7..429fbc6ba7 100644 --- a/module/move/wca/tests/inc/grammar/types.rs +++ b/module/move/wca/tests/inc/grammar/types.rs @@ -126,6 +126,17 @@ tests_impls! let inner_numbers : Vec< f64 > = numbers.into(); a_id!( vec![ 100.0, 3.14 ], inner_numbers ); } + + fn values_list_display() + { + let origin_string = "some,string"; + let string = Type::List( Type::String.into(), ',' ).try_cast( origin_string.into() ).unwrap(); + a_id!( origin_string, string.to_string() ); + + let origin_string = "100;3.14"; + let string = Type::List( Type::Number.into(), ';' ).try_cast( origin_string.into() ).unwrap(); + a_id!( origin_string, string.to_string() ); + } } // @@ -137,4 +148,5 @@ tests_index! path, boolean, values_list, + values_list_display, }