Skip to content

Commit

Permalink
Merge branch 'master' into release/Caba
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveGilham committed Apr 10, 2018
2 parents 0cbf6bf + b9bf4fa commit 3d2beff
Show file tree
Hide file tree
Showing 17 changed files with 736 additions and 24 deletions.
13 changes: 9 additions & 4 deletions AltCover/CommandLine.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ open System
open System.Diagnostics
open System.Globalization
open System.IO
open System.Linq
open System.Reflection
open System.Resources

Expand Down Expand Up @@ -42,10 +43,14 @@ module CommandLine =
let internal Usage ((intro:string), (o1:obj), (o2:obj)) =
let options = o1 :?> OptionSet
let options2 = o2 :?> OptionSet
WriteColoured Console.Error ConsoleColor.Yellow (fun w -> w.WriteLine (resources.GetString intro)
options.WriteOptionDescriptions(w)
w.WriteLine (resources.GetString "binder")
options2.WriteOptionDescriptions(w))
WriteColoured Console.Error ConsoleColor.Yellow (fun w -> if options.Any() || options2.Any() then
w.WriteLine (resources.GetString intro)
if options.Any() then
options.WriteOptionDescriptions(w)
if options.Any() && options2.Any() then
w.WriteLine (resources.GetString "binder")
if options2.Any() then
options2.WriteOptionDescriptions(w))

let internal Write (writer:TextWriter) colour data =
if not(String.IsNullOrEmpty(data)) then
Expand Down
2 changes: 1 addition & 1 deletion AltCover/Filter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module Filter =
attributeProvider.CustomAttributes
|> Seq.cast<CustomAttribute>
|> Seq.exists (fun attr ->
name.IsMatch attr.Constructor.DeclaringType.FullName)
name.IsMatch attr.AttributeType.FullName)
| _ -> false

let MatchItem<'a> (name:Regex) (nameProvider:Object) (toName: 'a -> string) =
Expand Down
7 changes: 4 additions & 3 deletions AltCover/Main.fs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
namespace AltCover

module AltCover =

[<EntryPoint>]
let private Main arguments =
let internal ToConsole () =
Output.Error <- CommandLine.WriteErr
Output.Usage <- CommandLine.Usage
Output.Echo <- CommandLine.WriteErr
Output.Info <- CommandLine.WriteOut

[<EntryPoint>]
let private Main arguments =
ToConsole()
AltCover.Main.EffectiveMain arguments
386 changes: 381 additions & 5 deletions AltCover/Runner.fs

Large diffs are not rendered by default.

26 changes: 25 additions & 1 deletion AltCover/Strings.eo.resx
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
<data name="HelpText" xml:space="preserve">
<value>AltCover [/i[nputDirectory]=VALO] [/o[utputDirectory]=VALO] [/y|symbolDirectory=VALO] [/sn|strongNameKey=VALO] [/k[ey]=VALO] [/x[mlReport]=VALO] [/f[ileFilter]=VALO] [/s|assemblyFilter=VALO] [/t|typeFilter=VALO] [/m|methodFilter=VALO] [/a|attributeFilter=VALO] [/c[allContext]=VALO] [--opencover] [--inplace] [--save] [/?|h[elp]] [-- ] [...]
AltCover Runner [/r[ecordingDirectory]=VALO] [/w[orkingDirectory]=VALO] [/x||executable=VALO] [--collect] [/?|h[elp]] [-- ] [...]
AltCover Runner [/r[ecordingDirectory]=VALO] [/w[orkingDirectory]=VALO] [/x||executable=VALO] [--collect] [/l[covReport]=VALO] [/?|h[elp]] [-- ] [...]
Vidu https://github.com/SteveGilham/altcover/wiki/Usage por plenaj detaloj.</value>
</data>
<data name="NotInPlace" xml:space="preserve">
Expand Down Expand Up @@ -259,4 +259,28 @@ Vidu https://github.com/SteveGilham/altcover/wiki/Usage por plenaj detaloj.</val
<data name="SaveExists" xml:space="preserve">
<value>Elŝuta dosierujo por konservitaj dosieroj {0} jam ekzistas</value>
</data>
<data name="l|lcovReport=" xml:space="preserve">
<value>Laŭvola: Dosiero por la versio de formato lcov de la datumoj kolektitaj</value>
</data>
<data name="Alternative" xml:space="preserve">
<value>==== Alternativaj Rezultoj (inkluzivas ĉiujn metodojn inkluzive de tiuj sen responda fonto) ====</value>
</data>
<data name="AltVC" xml:space="preserve">
<value>Alternativaj Vizititaj Klasoj {0} de {1} ({2})</value>
</data>
<data name="AltVM" xml:space="preserve">
<value>Alternativaj Vizititaj Metodoj {0} de {1} ({2})</value>
</data>
<data name="VisitedBranches" xml:space="preserve">
<value>Vizititaj Branĉoj {0} de {1} ({2})</value>
</data>
<data name="VisitedClasses" xml:space="preserve">
<value>Vizititaj Klasoj {0} de {1} ({2})</value>
</data>
<data name="VisitedMethods" xml:space="preserve">
<value>Vizititaj Metodoj {0} de {1} ({2})</value>
</data>
<data name="VisitedPoints" xml:space="preserve">
<value>Vizititaj Punktoj {0} de {1} ({2})</value>
</data>
</root>
26 changes: 25 additions & 1 deletion AltCover/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
<data name="HelpText" xml:space="preserve">
<value>AltCover [/i[nputDirectory]=VALUE] [/o[utputDirectory]=VALUE] [/y|symbolDirectory=VALUE] [/sn|strongNameKey=VALUE] [/k[ey]=VALUE] [/x[mlReport]=VALUE] [/f[ileFilter]=VALUE] [/s|assemblyFilter=VALUE] [/t|typeFilter=VALUE] [/m|methodFilter=VALUE] [/a|attributeFilter=VALUE] [/c[allContext]=VALUE] [--opencover] [--inplace] [--save] [/?|h[elp]] [-- ] [...]
or
AltCover Runner [/r[ecordingDirectory]=VALUE] [/w[orkingDirectory]=VALUE] [/x||executable=VALUE] [--collect] [/?|h[elp]] [-- ] [...]
AltCover Runner [/r[ecordingDirectory]=VALUE] [/w[orkingDirectory]=VALUE] [/x|executable=VALUE] [--collect] [/l[covReport]=VALUE] [/?|h[elp]] [-- ] [...]
See https://github.com/SteveGilham/altcover/wiki/Usage for full details.
</value>
</data>
Expand Down Expand Up @@ -260,4 +260,28 @@ See https://github.com/SteveGilham/altcover/wiki/Usage for full details.
<data name="SaveExists" xml:space="preserve">
<value>Output directory for saved files {0} already exists</value>
</data>
<data name="l|lcovReport=" xml:space="preserve">
<value>Optional: File for lcov format version of the collected data</value>
</data>
<data name="Alternative" xml:space="preserve">
<value>==== Alternative Results (includes all methods including those without corresponding source) ====</value>
</data>
<data name="AltVC" xml:space="preserve">
<value>Alternative Visited Classes {0} of {1} ({2})</value>
</data>
<data name="AltVM" xml:space="preserve">
<value>Alternative Visited Methods {0} of {1} ({2})</value>
</data>
<data name="VisitedBranches" xml:space="preserve">
<value>Visited Branches {0} of {1} ({2})</value>
</data>
<data name="VisitedClasses" xml:space="preserve">
<value>Visited Classes {0} of {1} ({2})</value>
</data>
<data name="VisitedMethods" xml:space="preserve">
<value>Visited Methods {0} of {1} ({2})</value>
</data>
<data name="VisitedPoints" xml:space="preserve">
<value>Visited Points {0} of {1} ({2})</value>
</data>
</root>
3 changes: 3 additions & 0 deletions AltCover/Tasks.fs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ type Collect () =
member val RecorderDirectory = String.Empty with get, set
member val WorkingDirectory = String.Empty with get, set
member val Executable = String.Empty with get, set
member val LcovReport = String.Empty with get, set

member val CommandLine = String.Empty with get, set

Expand All @@ -97,6 +98,8 @@ type Collect () =
Args.Item "-r" self.RecorderDirectory;
Args.Item "-w" self.WorkingDirectory;
Args.Item "-x" self.Executable;
Args.Item "-l" self.LcovReport;

Args.Flag "--collect" (self.Executable |> String.IsNullOrWhiteSpace)

Args.Item "--" self.CommandLine;
Expand Down
9 changes: 8 additions & 1 deletion AltCover/Visitor.fs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,14 @@ module Visitor =
[x]
|> Seq.takeWhile (fun _ -> included <> Inspect.Ignore)
|> Seq.collect(fun x -> x.GetAllTypes() |> Seq.cast)
|> Seq.collect ((fun t -> Type (t, UpdateInspection included t)) >> buildSequence)
|> Seq.collect ((fun t -> let types = Seq.unfold (fun (state:TypeDefinition) ->
if isNull state
then None
else Some (state, state.DeclaringType)) t
let inclusion = Seq.fold UpdateInspection
included
types
Type (t, inclusion)) >> buildSequence)

let internal Track (m : MethodDefinition) =
let name = m.Name
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# altcover
Instrumenting coverage tool for .net (framework and core) and Mono, reimplemented and extended from [dot-net-coverage](https://github.com/SteveGilham/dot-net-coverage)
Instrumenting coverage tool for .net (framework 2.0+ and core) and Mono, reimplemented and extended from [dot-net-coverage](https://github.com/SteveGilham/dot-net-coverage)

The latest releases can be downloaded from [releases](https://github.com/SteveGilham/altcover/releases), but the easiest (and most automated) way is through the [nuget package](https://www.nuget.org/packages/AltCover). Alternatively, for .net core, which can be run as a command line tool with `dotnet run`, you can just link from this repo as a Git module, and be as conservative or as bleeding-edge daring as you wish if that meets your needs.

Expand Down
5 changes: 5 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 3.0.404 (Caba series release 4)
* Exclusion by attribute on a class also extends to all nested classes, including invisible ones like lambda expressions and relatives.
* Runner mode (and the `AltCover.Collect` task) now outputs coverage summaries (class, method, point and, where available, branch)
* `-l|lcovReport` option in `runner` mode (parameter `LcovReport` for the `AltCover.Collect` task) to also output the result in lcov format

# 3.0.400 (Caba series release 3)
* [BUGFIX] -- malformed filter regexes no longer cause a crash, but are reported as normal errors
* F# auto-properties are now omitted from coverage, just as C# ones are (and have been since before v1.0.101)
Expand Down
21 changes: 21 additions & 0 deletions Tests/NCover.lcov
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
TN:
SF:altcover\Sample1\Program.cs
FN:11,System.Void TouchTest.Program.Main(System.String[])
FNDA:1,System.Void TouchTest.Program.Main(System.String[])
FNF:1
FNH:1
BRF:0
BRH:0
DA:11,1
DA:12,1
DA:13,1
DA:14,1
DA:15,1
DA:16,1
DA:18,0
DA:19,0
DA:20,X
DA:21,-1
LH:8
LF:10
end_of_record
23 changes: 23 additions & 0 deletions Tests/OpenCover.lcov
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
TN:
SF:altcover\Sample1\Program.cs
FN:11,System.Void TouchTest.Program::Main(System.String[])
FNDA:1,System.Void TouchTest.Program::Main(System.String[])
FNF:1
FNH:1
BRDA:13,11,0,1
BRDA:13,11,1,-
BRF:2
BRH:1
DA:11,1
DA:12,1
DA:13,1
DA:14,1
DA:15,1
DA:16,1
DA:18,0
DA:19,0
DA:20,X
DA:21,-1
LH:8
LF:10
end_of_record
Loading

0 comments on commit 3d2beff

Please sign in to comment.