File tree Expand file tree Collapse file tree 1 file changed +17
-9
lines changed
Expand file tree Collapse file tree 1 file changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ macro_rules! r {
9191
9292/// Write
9393macro_rules! w {
94- ( $id: ident => $ret_ty: ty) => {
94+ ( $id: ident => ( $ret_ty: ty | $test_val : expr ) ) => {
9595 paste:: paste! {
9696 impl $id {
9797 /// Writes `value` using string API.
@@ -112,29 +112,37 @@ macro_rules! w {
112112 #[ cfg( test) ]
113113 #[ test]
114114 fn [ <$id _write_test>] ( ) {
115- match stringify!( $id) {
116- "background_thread" |
117- "max_background_threads"
118- if cfg!( target_os = "macos" ) => return ,
119- _ => ( ) ,
115+ if ( cfg!( target_os = "macos" ) && ( stringify!( $id) == "background_thread"
116+ || stringify!( $id) == "max_background_threads" ) ) {
117+ return ;
120118 }
121119
122- let _ = $id:: write( $ret_ty:: default ( ) ) . unwrap( ) ;
120+ let test_val = $test_val;
121+
122+ let _ = $id:: write( test_val) . unwrap( ) ;
123123
124124 let mib = $id:: mib( ) . unwrap( ) ;
125- let _ = mib. write( $ret_ty :: default ( ) ) . unwrap( ) ;
125+ let _ = mib. write( test_val ) . unwrap( ) ;
126126
127127 #[ cfg( feature = "use_std" ) ]
128128 println!(
129129 concat!(
130130 stringify!( $id) ,
131131 " (write): \" {}\" " ) ,
132- $ret_ty :: default ( )
132+ test_val
133133 ) ;
134134
135135 }
136136 }
137137 } ;
138+ ( max_background_threads => $ret_ty: ty) => {
139+ // non-zero
140+ w!( max_background_threads => ( $ret_ty | 1 ) ) ;
141+ } ;
142+ ( $id: ident => $ret_ty: ty) => {
143+ // general case
144+ w!( $id => ( $ret_ty | Default :: default ( ) ) ) ;
145+ } ;
138146}
139147
140148/// Update
You can’t perform that action at this time.
0 commit comments