Skip to content

Commit d220050

Browse files
committed
doco
1 parent df7df23 commit d220050

6 files changed

Lines changed: 49 additions & 6 deletions

File tree

docs/diff-tool.order.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ To change this file edit the source file and then run MarkdownSnippets.
3434

3535
### ViaEnvironment Variable
3636

37-
Set an `Verify.DiffToolOrder` environment variable with the preferred order of toll resolution. The value can be comma (`,`), pipe (`|`), or space separated.
37+
Set an `DiffEngine.DiffToolOrder` environment variable with the preferred order of toll resolution. The value can be comma (`,`), pipe (`|`), or space separated.
3838

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

docs/mdsource/diff-tool.order.source.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ include: defaultDiffToolOrder
1111

1212
### ViaEnvironment Variable
1313

14-
Set an `Verify.DiffToolOrder` environment variable with the preferred order of toll resolution. The value can be comma (`,`), pipe (`|`), or space separated.
14+
Set an `DiffEngine.DiffToolOrder` environment variable with the preferred order of toll resolution. The value can be comma (`,`), pipe (`|`), or space separated.
1515

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.IO;
3+
4+
static class AssemblyLocation
5+
{
6+
static AssemblyLocation()
7+
{
8+
var assembly = typeof(AssemblyLocation).Assembly;
9+
10+
var uri = new UriBuilder(assembly.CodeBase!);
11+
var path = Uri.UnescapeDataString(uri.Path);
12+
13+
CurrentDirectory = Path.GetDirectoryName(path)!;
14+
}
15+
16+
public static string CurrentDirectory;
17+
}

src/DiffEngine.Tests/DiffRunnerTests.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,27 @@ public void Kill()
2727
#endregion
2828
}
2929

30+
//static string diffToolPath = Path.GetFullPath(Path.Combine(AssemblyLocation.CurrentDirectory, "../../../../FakeDiffTool/bin/FakeDiffTool.exe"));
31+
32+
//[Fact]
33+
//public void LaunchAndKill()
34+
//{
35+
// DiffTools.AddCustomTool(
36+
// supportsAutoRefresh: true,
37+
// isMdi: false,
38+
// supportsText: true,
39+
// requiresTarget: true,
40+
// buildArguments: (path1, path2) => $"\"{path1}\" \"{path2}\"",
41+
// exePath: diffToolPath,
42+
// binaryExtensions: new[] {"knownBin"});
43+
// var tempFile = Path.Combine(SourceDirectory, "DiffRunner.file1.txt");
44+
// var targetFile = Path.Combine(SourceDirectory, "DiffRunner.file2.txt");
45+
// DiffRunner.Launch(tempFile, targetFile);
46+
// Assert.NotEmpty(ProcessCleanup.FindAll());
47+
// DiffRunner.Kill(tempFile, targetFile);
48+
// Assert.Empty(ProcessCleanup.FindAll());
49+
//}
50+
3051
public DiffRunnerTests(ITestOutputHelper output) :
3152
base(output)
3253
{

src/DiffEngine.Tests/DiffToolsTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public void ParseEnvironmentVariable()
5353
public void BadEnvironmentVariable()
5454
{
5555
var exception = Assert.Throws<Exception>(() => DiffTools.ParseEnvironmentVariable("Foo").ToList());
56-
Assert.Equal("Unable to parse tool from `Verify.DiffToolOrder` environment variable: Foo", exception.Message);
56+
Assert.Equal("Unable to parse tool from `DiffEngine.DiffToolOrder` environment variable: Foo", exception.Message);
5757
}
5858

5959
[Fact]

src/DiffEngine/DiffTools.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,12 @@ internal static List<ToolDefinition> Tools()
7171

7272
static DiffTools()
7373
{
74-
var diffOrder = Environment.GetEnvironmentVariable("Verify.DiffToolOrder");
74+
var diffOrder = Environment.GetEnvironmentVariable("DiffEngine.ToolOrder");
75+
if (diffOrder == null)
76+
{
77+
diffOrder = Environment.GetEnvironmentVariable("Verify.DiffToolOrder");
78+
}
79+
7580
IEnumerable<DiffTool> order;
7681
bool throwForNoTool;
7782
if (string.IsNullOrWhiteSpace(diffOrder))
@@ -140,7 +145,7 @@ internal static IEnumerable<DiffTool> ParseEnvironmentVariable(string diffOrder)
140145
{
141146
if (!Enum.TryParse<DiffTool>(toolString, out var diffTool))
142147
{
143-
throw new Exception($"Unable to parse tool from `Verify.DiffToolOrder` environment variable: {toolString}");
148+
throw new Exception($"Unable to parse tool from `DiffEngine.DiffToolOrder` environment variable: {toolString}");
144149
}
145150

146151
yield return diffTool;
@@ -160,7 +165,7 @@ static IEnumerable<ToolDefinition> ToolsByOrder(bool throwForNoTool, IEnumerable
160165
continue;
161166
}
162167

163-
throw new Exception($"`Verify.DiffToolOrder` is configured to use '{diffTool}' but it is not installed.");
168+
throw new Exception($"`DiffEngine.DiffToolOrder` is configured to use '{diffTool}' but it is not installed.");
164169
}
165170

166171
yield return definition;

0 commit comments

Comments
 (0)