Skip to content

Commit

Permalink
Add ability to configure diff tool by env variable (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Apr 8, 2020
1 parent 5490641 commit bcc9639
Show file tree
Hide file tree
Showing 9 changed files with 574 additions and 429 deletions.
433 changes: 232 additions & 201 deletions docs/diff-tool.md

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions docs/mdsource/diff-tool.source.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,21 @@ include: diffTools
snippet: DisableDiff


## Diff Tool order


### Default

include: defaultDiffToolOrder


### Custom order

Set an `Verify.DiffToolOrder` with the preferred order of diff tool resolution. The value can be comma (`,`), pipe (`|`), or space separated.

For example `VisualStudio,Meld` will result in VisualStudio then Meld then all other tools being the order.


## DiffEngine

**API SUBJECT TO CHNAGE IN MINOR RELEASES**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Unable to parse tool from `Verify.DiffToolOrder` environment variable: Foo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[
'VisualStudio',
'Meld'
]
17 changes: 16 additions & 1 deletion src/DiffEngine.Tests/DiffToolsTest.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System.Diagnostics;
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using DiffEngine;
using VerifyXunit;
using Xunit;
Expand All @@ -18,6 +20,19 @@ public class DiffToolsTest :
// Assert.True(DiffTools.IsDetectedFor(DiffTool.BeyondCompare, "png"));
//}

[Fact]
public Task ParseEnvironmentVariable()
{
return Verify(DiffTools.ParseEnvironmentVariable("VisualStudio,Meld"));
}

[Fact]
public Task BadEnvironmentVariable()
{
var exception = Assert.Throws<Exception>(() => DiffTools.ParseEnvironmentVariable("Foo").ToList());
return Verify(exception.Message);
}

[Fact]
public void WriteFoundTools()
{
Expand Down
17 changes: 17 additions & 0 deletions src/DiffEngine.Tests/defaultDiffToolOrder.include.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
* BeyondCompare
* P4Merge
* AraxisMerge
* Meld
* SublimeMerge
* Kaleidoscope
* CodeCompare
* WinMerge
* DiffMerge
* TortoiseMerge
* TortoiseGitMerge
* TortoiseIDiff
* KDiff3
* TkDiff
* VisualStudioCode
* VisualStudio
* Rider

0 comments on commit bcc9639

Please sign in to comment.