File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,9 @@ semver = "1.0"
28
28
rustc-semver = " 1.1"
29
29
url = " 2.2"
30
30
31
+ [dev-dependencies ]
32
+ walkdir = " 2.3"
33
+
31
34
[features ]
32
35
deny-warnings = [" clippy_utils/deny-warnings" ]
33
36
# build clippy with internal lints enabled, off by default
Original file line number Diff line number Diff line change @@ -744,3 +744,44 @@ fn calculate_dimensions(fields: &[&str]) -> (usize, Vec<usize>) {
744
744
745
745
( rows, column_widths)
746
746
}
747
+
748
+ #[ cfg( test) ]
749
+ mod tests {
750
+ use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
751
+ use serde:: de:: IgnoredAny ;
752
+ use std:: fs;
753
+ use walkdir:: WalkDir ;
754
+
755
+ #[ test]
756
+ fn configs_are_tested ( ) {
757
+ let mut names: FxHashSet < String > = super :: metadata:: get_configuration_metadata ( )
758
+ . into_iter ( )
759
+ . map ( |meta| meta. name . replace ( '_' , "-" ) )
760
+ . collect ( ) ;
761
+
762
+ let toml_files = WalkDir :: new ( "../tests" )
763
+ . into_iter ( )
764
+ . map ( Result :: unwrap)
765
+ . filter ( |entry| entry. file_name ( ) == "clippy.toml" ) ;
766
+
767
+ for entry in toml_files {
768
+ let file = fs:: read_to_string ( entry. path ( ) ) . unwrap ( ) ;
769
+ #[ allow( clippy:: zero_sized_map_values) ]
770
+ if let Ok ( map) = toml:: from_str :: < FxHashMap < String , IgnoredAny > > ( & file) {
771
+ for name in map. keys ( ) {
772
+ names. remove ( name. as_str ( ) ) ;
773
+ }
774
+ }
775
+ }
776
+
777
+ assert ! (
778
+ names. remove( "allow-one-hash-in-raw-strings" ) ,
779
+ "remove this when #11481 is fixed"
780
+ ) ;
781
+
782
+ assert ! (
783
+ names. is_empty( ) ,
784
+ "Configuration variable lacks test: {names:?}\n Add a test to `tests/ui-toml`"
785
+ ) ;
786
+ }
787
+ }
You can’t perform that action at this time.
0 commit comments