Skip to content

Commit

Permalink
Wrote a test that shows an issue related to value displaying
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Barsik-sus committed May 13, 2024
1 parent 621003e commit 38c5dfd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions module/move/wca/tests/inc/grammar/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() );
}
}

//
Expand All @@ -137,4 +148,5 @@ tests_index!
path,
boolean,
values_list,
values_list_display,
}

0 comments on commit 38c5dfd

Please sign in to comment.