File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -1143,6 +1143,36 @@ mod test {
11431143 assert_eq ! ( mutants, [ ] ) ;
11441144 }
11451145
1146+ #[ test]
1147+ fn do_not_skip_functions_with_non_test_attributes ( ) {
1148+ let mutants = mutate_source_str (
1149+ indoc ! { "
1150+ #[derive(Debug)]
1151+ pub fn testing_something() -> i32 {
1152+ 42
1153+ }
1154+
1155+ #[some_crate::test]
1156+ fn some_test() {
1157+ println!(\" test\" );
1158+ }
1159+
1160+ #[some_attr]
1161+ pub fn regular_function() -> i32 {
1162+ 100
1163+ }
1164+ " } ,
1165+ & Options :: default ( ) ,
1166+ )
1167+ . unwrap ( ) ;
1168+ // Should have mutants for testing_something and regular_function, but not for some_test
1169+ let mutant_names = mutants. iter ( ) . map ( |m| m. name ( false ) ) . collect_vec ( ) ;
1170+ assert_eq ! ( mutant_names. len( ) , 6 ) ; // 3 mutants each for the two non-test functions
1171+ assert ! ( mutant_names. iter( ) . any( |n| n. contains( "testing_something" ) ) ) ;
1172+ assert ! ( mutant_names. iter( ) . any( |n| n. contains( "regular_function" ) ) ) ;
1173+ assert ! ( !mutant_names. iter( ) . any( |n| n. contains( "some_test" ) ) ) ;
1174+ }
1175+
11461176 /// Skip mutating arguments to a particular named function.
11471177 #[ test]
11481178 fn skip_named_fn ( ) {
You can’t perform that action at this time.
0 commit comments