1 bool test(string moduleName, string filters) 2 { 3 StaticAnalysisConfig config; 4 // it doesn't matter which check we test here 5 config.asm_style_check = Check.enabled; 6 // this is done automatically by inifiled 7 config.filters.asm_style_check = filters.split(","); 8 return shouldRun!"asm_style_check"(moduleName, config); 9 } 10 11 // test inclusion 12 assert(test("std.foo", "+std.")); 13 // partial matches are ok 14 assert(test("std.foo", "+bar,+foo")); 15 // full as well 16 assert(test("std.foo", "+bar,+std.foo,+foo")); 17 // mismatch 18 assert(!test("std.foo", "+bar,+banana")); 19 20 // test exclusion 21 assert(!test("std.foo", "-std.")); 22 assert(!test("std.foo", "-bar,-std.foo")); 23 assert(!test("std.foo", "-bar,-foo")); 24 // mismatch 25 assert(test("std.foo", "-bar,-banana")); 26 27 // test combination (exclusion has precedence) 28 assert(!test("std.foo", "+foo,-foo")); 29 assert(test("std.foo", "+foo,-bar")); 30 assert(test("std.bar.foo", "-barr,+bar"));
Checks whether a module is part of a user-specified include/exclude list. The user can specify a comma-separated list of filters, everyone needs to start with either a '+' (inclusion) or '-' (exclusion). If no includes are specified, all modules are included.