File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -96,9 +96,10 @@ impl Create2Args {
9696 ) ) ;
9797 }
9898 if let Some ( suffix) = ends_with {
99- regexs. push (
100- ( get_regex_hex_string ( suffix) . wrap_err ( "invalid suffix hex provided" ) ?) . to_string ( ) ,
101- ) ;
99+ regexs. push ( format ! (
100+ r"{}$" ,
101+ get_regex_hex_string( suffix) . wrap_err( "invalid prefix hex provided" ) ?
102+ ) )
102103 }
103104
104105 debug_assert ! (
@@ -204,6 +205,14 @@ mod tests {
204205
205206 assert ! ( address. starts_with( "aaa" ) ) ;
206207
208+ // odd hex chars with 0x suffix
209+ let args = Create2Args :: parse_from ( [ "foundry-cli" , "--ends-with" , "bb" ] ) ;
210+ let create2_out = args. run ( ) . unwrap ( ) ;
211+ let address = create2_out. address ;
212+ let address = format ! ( "{address:x}" ) ;
213+
214+ assert ! ( address. ends_with( "bb" ) ) ;
215+
207216 // check fails on wrong chars
208217 let args = Create2Args :: parse_from ( [ "foundry-cli" , "--starts-with" , "0xerr" ] ) ;
209218 let create2_out = args. run ( ) ;
You can’t perform that action at this time.
0 commit comments