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"]
73
73
[workspace ]
74
74
members = [" ci/svd2rust-regress" ]
75
75
default-members = [" ." ]
76
- exclude = [" output" ]
76
+ exclude = [" output" ]
Original file line number Diff line number Diff line change @@ -158,16 +158,15 @@ impl Diffing {
158
158
. collect :: < Vec < _ > > ( ) ;
159
159
if tests. len ( ) != 1 {
160
160
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
+ } ) ;
171
170
}
172
171
173
172
let baseline = tests[ 0 ]
Original file line number Diff line number Diff line change @@ -245,9 +245,10 @@ impl TestCase {
245
245
true ,
246
246
"svd2rust" ,
247
247
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
+ )
251
252
} ) ,
252
253
Some ( & svd2rust_err_file) ,
253
254
& [ ] ,
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ impl std::fmt::Display for Manufacturer {
55
55
}
56
56
57
57
#[ derive( Debug , serde:: Serialize , serde:: Deserialize ) ]
58
+ #[ serde( rename_all = "kebab-case" ) ]
58
59
pub enum RunWhen {
59
60
Always ,
60
61
NotShort ,
@@ -68,6 +69,7 @@ pub struct TestCase {
68
69
pub arch : Target ,
69
70
pub mfgr : Manufacturer ,
70
71
pub chip : String ,
72
+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
71
73
svd_url : Option < String > ,
72
74
pub should_pass : bool ,
73
75
run_when : RunWhen ,
You can’t perform that action at this time.
0 commit comments