@@ -406,6 +406,15 @@ mod test {
406
406
#[ allow( dead_code) ]
407
407
mod mock {
408
408
use super :: super :: * ;
409
+ use rustfmt_config_proc_macro:: config_type;
410
+
411
+ #[ config_type]
412
+ pub enum PartiallyUnstableOption {
413
+ V1 ,
414
+ V2 ,
415
+ #[ unstable_variant]
416
+ V3 ,
417
+ }
409
418
410
419
create_config ! {
411
420
// Options that are used by the generated functions
@@ -449,6 +458,8 @@ mod test {
449
458
// Options that are used by the tests
450
459
stable_option: bool , false , true , "A stable option" ;
451
460
unstable_option: bool , false , false , "An unstable option" ;
461
+ partially_unstable_option: PartiallyUnstableOption , PartiallyUnstableOption :: V1 , true ,
462
+ "A partially unstable option" ;
452
463
}
453
464
}
454
465
@@ -918,4 +929,42 @@ make_backup = false
918
929
assert_eq ! ( config. single_line_if_else_max_width( ) , 100 ) ;
919
930
}
920
931
}
932
+
933
+ #[ cfg( test) ]
934
+ mod partially_unstable_option {
935
+ use super :: mock:: { Config , PartiallyUnstableOption } ;
936
+ use super :: * ;
937
+
938
+ #[ test]
939
+ fn test_override_stable_value ( ) {
940
+ let mut config = Config :: default ( ) ;
941
+ config. override_value ( "partially_unstable_option" , "V2" ) ;
942
+ assert_eq ! (
943
+ config. partially_unstable_option( ) ,
944
+ PartiallyUnstableOption :: V2
945
+ ) ;
946
+ }
947
+
948
+ #[ stable_only_test]
949
+ #[ test]
950
+ fn test_override_unstable_value_on_stable ( ) {
951
+ let mut config = Config :: default ( ) ;
952
+ config. override_value ( "partially_unstable_option" , "V3" ) ;
953
+ assert_eq ! (
954
+ config. partially_unstable_option( ) ,
955
+ PartiallyUnstableOption :: V1
956
+ ) ;
957
+ }
958
+
959
+ #[ nightly_only_test]
960
+ #[ test]
961
+ fn test_override_unstable_value_on_nightly ( ) {
962
+ let mut config = Config :: default ( ) ;
963
+ config. override_value ( "partially_unstable_option" , "V3" ) ;
964
+ assert_eq ! (
965
+ config. partially_unstable_option( ) ,
966
+ PartiallyUnstableOption :: V3
967
+ ) ;
968
+ }
969
+ }
921
970
}
0 commit comments