File tree Expand file tree Collapse file tree 6 files changed +536
-1036
lines changed Expand file tree Collapse file tree 6 files changed +536
-1036
lines changed Original file line number Diff line number Diff line change @@ -73,4 +73,4 @@ features = ["full","extra-traits"]
7373[workspace ]
7474members = [" ci/svd2rust-regress" ]
7575default-members = [" ." ]
76- exclude = [" output" ]
76+ exclude = [" output" ]
Original file line number Diff line number Diff line change @@ -158,16 +158,15 @@ impl Diffing {
158158 . collect :: < Vec < _ > > ( ) ;
159159 if tests. len ( ) != 1 {
160160 let error = anyhow:: anyhow!( "diff requires exactly one test case" ) ;
161- if tests. is_empty ( ) {
162- return Err ( error. context ( "matched no tests" ) ) ;
163- } else if tests. len ( ) > 10 {
164- return Err ( error. context ( format ! ( "matched multiple ({}) tests" , tests. len( ) ) ) ) ;
165- }
166- return Err ( error. context ( format ! (
167- "matched multiple ({}) tests\n {:?}" ,
168- tests. len( ) ,
169- tests. iter( ) . map( |t| t. name( ) ) . collect:: <Vec <_>>( )
170- ) ) ) ;
161+ let len = tests. len ( ) ;
162+ return Err ( match len {
163+ 0 => error. context ( "matched no tests" ) ,
164+ 10 .. => error. context ( format ! ( "matched multiple ({len}) tests" ) ) ,
165+ _ => error. context ( format ! (
166+ "matched multiple ({len}) tests\n {:?}" ,
167+ tests. iter( ) . map( |t| t. name( ) ) . collect:: <Vec <_>>( )
168+ ) ) ,
169+ } ) ;
171170 }
172171
173172 let baseline = tests[ 0 ]
Original file line number Diff line number Diff line change @@ -245,9 +245,10 @@ impl TestCase {
245245 true ,
246246 "svd2rust" ,
247247 Some ( & lib_rs_file) . filter ( |_| {
248- ( self . arch != Target :: CortexM )
249- && ( self . arch != Target :: Msp430 )
250- && ( self . arch != Target :: XtensaLX )
248+ !matches ! (
249+ self . arch,
250+ Target :: CortexM | Target :: Msp430 | Target :: XtensaLX
251+ )
251252 } ) ,
252253 Some ( & svd2rust_err_file) ,
253254 & [ ] ,
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ impl std::fmt::Display for Manufacturer {
5555}
5656
5757#[ derive( Debug , serde:: Serialize , serde:: Deserialize ) ]
58+ #[ serde( rename_all = "kebab-case" ) ]
5859pub enum RunWhen {
5960 Always ,
6061 NotShort ,
@@ -68,6 +69,7 @@ pub struct TestCase {
6869 pub arch : Target ,
6970 pub mfgr : Manufacturer ,
7071 pub chip : String ,
72+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
7173 svd_url : Option < String > ,
7274 pub should_pass : bool ,
7375 run_when : RunWhen ,
You can’t perform that action at this time.
0 commit comments