File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
src/coverlet.core/Helpers
test/coverlet.core.tests/Helpers Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ internal static class InstrumentationHelper
15
15
{
16
16
public static string [ ] GetCoverableModules ( string module )
17
17
{
18
- IEnumerable < string > modules = Directory . GetFiles ( Path . GetDirectoryName ( module ) , "*. dll") ;
18
+ IEnumerable < string > modules = Directory . EnumerateFiles ( Path . GetDirectoryName ( module ) ) . Where ( f => f . EndsWith ( ".exe" ) || f . EndsWith ( ". dll") ) ;
19
19
modules = modules . Where ( m => IsAssembly ( m ) && Path . GetFileName ( m ) != Path . GetFileName ( module ) ) ;
20
20
return modules . ToArray ( ) ;
21
21
}
Original file line number Diff line number Diff line change 1
1
using System ;
2
2
using System . IO ;
3
-
4
3
using Xunit ;
5
4
using System . Collections . Generic ;
6
5
using System . Linq ;
@@ -17,6 +16,21 @@ public void TestGetDependencies()
17
16
Assert . False ( Array . Exists ( modules , m => m == module ) ) ;
18
17
}
19
18
19
+ [ Fact ]
20
+ public void TestExeModulesCoverage ( )
21
+ {
22
+ string module = typeof ( InstrumentationHelperTests ) . Assembly . Location ;
23
+ string exeModule = Path . ChangeExtension ( module , ".exe" ) ;
24
+ string noExtModule = Path . ChangeExtension ( module , "" ) . TrimEnd ( '.' ) ;
25
+ File . Delete ( exeModule ) ;
26
+ File . Copy ( module , exeModule ) ;
27
+ File . Delete ( noExtModule ) ;
28
+ File . Copy ( module , noExtModule ) ;
29
+ var modules = InstrumentationHelper . GetCoverableModules ( module ) ;
30
+ Assert . True ( Array . Exists ( modules , m => m == exeModule ) ) ;
31
+ Assert . False ( Array . Exists ( modules , m => m == noExtModule ) ) ;
32
+ }
33
+
20
34
[ Fact ]
21
35
public void TestHasPdb ( )
22
36
{
You can’t perform that action at this time.
0 commit comments