Skip to content

Commit de3f4b9

Browse files
committed
Squashed commit of the following:
commit efd9467 Author: Egil Hansen <[email protected]> Date: Sun Nov 24 11:56:22 2019 +0000 Updated changelog commit 8694b8f Author: Egil Hansen <[email protected]> Date: Sun Nov 24 11:52:27 2019 +0000 Added HtmlDifferenceEngine.Compare(INode controlNode, INode testNode) to make it easier to compare single nodes to each other. commit 6346069 Author: Egil Hansen <[email protected]> Date: Fri Nov 22 13:54:25 2019 +0000 Added docs to AttributeComparisonSource commit 585337d Merge: 5085ed2 282f679 Author: Egil Hansen <[email protected]> Date: Sun Nov 3 23:59:38 2019 +0000 Merge from master commit 5085ed2 Author: Egil Hansen <[email protected]> Date: Sun Nov 3 23:37:13 2019 +0000 Tweaks to cake config commit 38b46ed Author: Egil Hansen <[email protected]> Date: Sun Nov 3 23:19:08 2019 +0000 Enabled build during Unit Test cake step commit 3ff9e47 Author: Egil Hansen <[email protected]> Date: Sun Nov 3 23:17:01 2019 +0000 Enabled build during Create Package cake step commit fc2a527 Author: Egil Hansen <[email protected]> Date: Sun Nov 3 23:13:21 2019 +0000 Reverted back to older version of tunnelvisionlabs.referenceassemblyannotator commit b5a823c Author: Egil Hansen <[email protected]> Date: Sun Nov 3 23:05:30 2019 +0000 Preview 1 release commit e4502f6 Author: Egil Hansen <[email protected]> Date: Sat Nov 2 15:31:09 2019 +0000 Small tweaks to api commit 8449eab Author: Egil Hansen <[email protected]> Date: Fri Nov 1 23:16:13 2019 +0000 Tweaked DiffBuilders options handling, updated documentation commit 62ada9f Author: Egil Hansen <[email protected]> Date: Fri Nov 1 21:57:32 2019 +0000 Added docs generation commit 290d431 Merge: e2c88f2 8fe6a54 Author: Egil Hansen <[email protected]> Date: Fri Nov 1 21:34:01 2019 +0000 Merge pull request #2 from AngleSharp/feature/anglesharp-cicd AngleSharp CI/CD commit 8fe6a54 Author: Egil Hansen <[email protected]> Date: Fri Nov 1 21:27:40 2019 +0000 Remove appveyor logger during testing commit 5d6460d Author: Egil Hansen <[email protected]> Date: Fri Nov 1 21:17:49 2019 +0000 Fixed WithDefaultOptions logic where text nodes was compared by a naive node comparer, not text comparer commit 64bae82 Author: Egil Hansen <[email protected]> Date: Fri Nov 1 20:53:01 2019 +0000 more fixes after merge commit baef331 Author: Egil Hansen <[email protected]> Date: Fri Nov 1 20:43:47 2019 +0000 fixes after namespace changes commit d99c828 Author: Egil Hansen <[email protected]> Date: Fri Nov 1 14:50:36 2019 +0000 renamed builder for more flexibility and usecases commit 5d4a245 Merge: 038c640 6057251 Author: Florian Rappl <[email protected]> Date: Fri Nov 1 11:50:55 2019 +0100 Merge branch 'feature/anglesharp-cicd' of github.com:AngleSharp/AngleSharp.Diffing into feature/anglesharp-cicd commit 6057251 Author: Egil Hansen <[email protected]> Date: Fri Nov 1 10:49:03 2019 +0000 additional cleanup of csproj commit 038c640 Merge: 9a161f7 44c8c69 Author: Florian Rappl <[email protected]> Date: Fri Nov 1 11:46:20 2019 +0100 Merge branch 'feature/anglesharp-cicd' of github.com:AngleSharp/AngleSharp.Diffing into feature/anglesharp-cicd commit 9a161f7 Author: Florian Rappl <[email protected]> Date: Fri Nov 1 11:46:12 2019 +0100 Namespace renamed commit 44c8c69 Author: Egil Hansen <[email protected]> Date: Fri Nov 1 10:38:37 2019 +0000 cleanup of csproj commit 9a33131 Author: Egil Hansen <[email protected]> Date: Thu Oct 31 23:16:36 2019 +0000 Removed CI github action commit 06f0a68 Author: Florian Rappl <[email protected]> Date: Thu Oct 31 23:52:37 2019 +0100 Try 2019 image commit 68f2f26 Author: Egil Hansen <[email protected]> Date: Thu Oct 31 21:54:02 2019 +0000 Fixed path issues and C# version/target commit ed9f4b9 Author: Florian Rappl <[email protected]> Date: Thu Oct 31 22:26:11 2019 +0100 Updated devel to dev commit 4f62811 Author: Florian Rappl <[email protected]> Date: Thu Oct 31 22:23:26 2019 +0100 Build process set up commit 720e482 Author: Florian Rappl <[email protected]> Date: Thu Oct 31 22:23:18 2019 +0100 Ignore tools commit 1863844 Author: Florian Rappl <[email protected]> Date: Thu Oct 31 22:23:08 2019 +0100 Add changelog commit 6589ed1 Merge: 217bb3f 3fdf871 Author: Florian Rappl <[email protected]> Date: Thu Oct 31 22:23:01 2019 +0100 Moved files / folder structure commit 3fdf871 Author: Florian Rappl <[email protected]> Date: Sat May 18 14:06:25 2019 +0200 Added tools commit 246f382 Author: Florian Rappl <[email protected]> Date: Sat May 18 13:48:06 2019 +0200 Updated info on common files commit 2d54c6e Author: Florian Rappl <[email protected]> Date: Sat May 18 13:38:10 2019 +0200 Initial commit
1 parent 282f679 commit de3f4b9

File tree

5 files changed

+46
-17
lines changed

5 files changed

+46
-17
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# 0.13.0-preview-3
2+
3+
Released on Sunday, November 24, 2019.
4+
5+
- Added `Compare(INode controlNode, INode testNode)` to HtmlDifferenceEngine
6+
- Changed existing `Compare` method in HtmlDifferenceEngine to take `IEnumerable<INode>` instead of `INodeList`.
7+
18
# 0.13.0-preview-2
29

310
Released on Sunday, November 3, 2019.

src/AngleSharp.Diffing/Core/AttributeComparisonSource.cs

+14-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,24 @@ namespace AngleSharp.Diffing.Core
77
{
88
public readonly struct AttributeComparisonSource : IEquatable<AttributeComparisonSource>, IComparisonSource
99
{
10+
/// <summary>
11+
/// Gets the attribute attached to this source.
12+
/// </summary>
1013
public IAttr Attribute { get; }
1114

15+
/// <summary>
16+
/// Gets the element source this attribute source is related to.
17+
/// </summary>
1218
public ComparisonSource ElementSource { get; }
1319

20+
/// <summary>
21+
/// Gets the path to the attribute in the source node tree.
22+
/// </summary>
1423
public string Path { get; }
1524

25+
/// <summary>
26+
/// Gets the source type, e.g. if it is a test or control source.
27+
/// </summary>
1628
public ComparisonSourceType SourceType { get; }
1729

1830
[SuppressMessage("Globalization", "CA1308:Normalize strings to uppercase", Justification = "Path should be in lower case")]
@@ -29,13 +41,13 @@ public AttributeComparisonSource(string attributeName, in ComparisonSource eleme
2941
}
3042

3143
#region Equals and HashCode
32-
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
44+
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
3345
public bool Equals(AttributeComparisonSource other) => Object.ReferenceEquals(Attribute, other.Attribute) && Path.Equals(other.Path, StringComparison.Ordinal) && ElementSource.Equals(other.ElementSource);
3446
public override int GetHashCode() => (Attribute, ElementSource).GetHashCode();
3547
public override bool Equals(object? obj) => obj is AttributeComparisonSource other && Equals(other);
3648
public static bool operator ==(AttributeComparisonSource left, AttributeComparisonSource right) => left.Equals(right);
3749
public static bool operator !=(AttributeComparisonSource left, AttributeComparisonSource right) => !left.Equals(right);
38-
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member
50+
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member
3951
#endregion
4052
}
4153
}

src/AngleSharp.Diffing/Core/HtmlDifferenceEngine.cs

+13-5
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,37 @@ public HtmlDifferenceEngine(IDiffingStrategy diffingStrategy)
1616
_diffingStrategy = diffingStrategy ?? throw new ArgumentNullException(nameof(diffingStrategy));
1717
}
1818

19-
public IEnumerable<IDiff> Compare(INodeList controlNodes, INodeList testNodes)
19+
public IEnumerable<IDiff> Compare(INode controlNode, INode testNode)
20+
{
21+
if (controlNode is null) throw new ArgumentNullException(nameof(controlNode));
22+
if (testNode is null) throw new ArgumentNullException(nameof(testNode));
23+
24+
return Compare(new[] { controlNode }, new[] { testNode });
25+
}
26+
27+
public IEnumerable<IDiff> Compare(IEnumerable<INode> controlNodes, IEnumerable<INode> testNodes)
2028
{
2129
if (controlNodes is null) throw new ArgumentNullException(nameof(controlNodes));
2230
if (testNodes is null) throw new ArgumentNullException(nameof(testNodes));
2331

2432
var controlSources = controlNodes.ToSourceCollection(ComparisonSourceType.Control);
2533
var testSources = testNodes.ToSourceCollection(ComparisonSourceType.Test);
2634

27-
var context = CreateDiffContext(controlNodes, testNodes);
35+
var context = CreateDiffContext(controlSources, testSources);
2836

2937
var diffs = CompareNodeLists(context, controlSources, testSources);
3038
var unmatchedDiffs = context.GetDiffsFromUnmatched();
3139

3240
return diffs.Concat(unmatchedDiffs);
3341
}
3442

35-
private static DiffContext CreateDiffContext(INodeList controlNodes, INodeList testNodes)
43+
private static DiffContext CreateDiffContext(SourceCollection controlNodes, SourceCollection testNodes)
3644
{
3745
IElement? controlRoot = null;
3846
IElement? testRoot = null;
3947

40-
if (controlNodes.Length > 0 && controlNodes[0].GetRoot() is IElement r1) { controlRoot = r1; }
41-
if (testNodes.Length > 0 && testNodes[0].GetRoot() is IElement r2) { testRoot = r2; }
48+
if (controlNodes.Count > 0 && controlNodes.First().Node.GetRoot() is IElement r1) { controlRoot = r1; }
49+
if (testNodes.Count > 0 && testNodes.First().Node.GetRoot() is IElement r2) { testRoot = r2; }
4250

4351
return new DiffContext(controlRoot, testRoot);
4452
}

src/AngleSharp.Diffing/Extensions/NodeListExtensions.cs

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using AngleSharp.Dom;
44
using AngleSharp.Diffing.Core;
@@ -7,18 +7,20 @@ namespace AngleSharp.Diffing
77
{
88
public static class AngleSharpDomExtensions
99
{
10-
public static SourceCollection ToSourceCollection(this INodeList nodelist, ComparisonSourceType sourceType, string path = "")
10+
public static SourceCollection ToSourceCollection(this IEnumerable<INode> nodelist, ComparisonSourceType sourceType, string path = "")
1111
{
1212
return new SourceCollection(sourceType, nodelist.ToComparisonSourceList(sourceType, path));
1313
}
1414

15-
public static IEnumerable<ComparisonSource> ToComparisonSourceList(this INodeList nodes, ComparisonSourceType sourceType, string path = "")
15+
public static IEnumerable<ComparisonSource> ToComparisonSourceList(this IEnumerable<INode> nodes, ComparisonSourceType sourceType, string path = "")
1616
{
1717
if (nodes is null) throw new ArgumentNullException(nameof(nodes));
1818

19-
for (int index = 0; index < nodes.Length; index++)
19+
var index = 0;
20+
foreach (var node in nodes)
2021
{
21-
yield return nodes[index].ToComparisonSource(index, sourceType, path);
22+
yield return node.ToComparisonSource(index, sourceType, path);
23+
index += 1;
2224
}
2325
yield break;
2426
}

tools/anglesharp.cake

+5-5
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ Task("Build")
5858
.IsDependentOn("Restore-Packages")
5959
.Does(() =>
6060
{
61-
var settings = new DotNetCoreMSBuildSettings();
62-
settings.WarningCodesAsMessage.Add("CS1591"); // During CI builds we don't want the output polluted by "warning CS1591: Missing XML comment" warnings
61+
var buildSettings = new DotNetCoreMSBuildSettings();
62+
buildSettings.WarningCodesAsMessage.Add("CS1591"); // During CI builds we don't want the output polluted by "warning CS1591: Missing XML comment" warnings
6363

6464
ReplaceRegexInFiles("./src/Directory.Build.props", "(?<=<Version>)(.+?)(?=</Version>)", version);
6565
DotNetCoreBuild($"./src/{solutionName}.sln", new DotNetCoreBuildSettings
6666
{
6767
Configuration = configuration,
68-
MSBuildSettings = settings
68+
MSBuildSettings = buildSettings
6969
});
7070
});
7171

@@ -76,7 +76,7 @@ Task("Run-Unit-Tests")
7676
var settings = new DotNetCoreTestSettings
7777
{
7878
Configuration = configuration,
79-
NoBuild = false
79+
NoBuild = false,
8080
};
8181

8282
if (isRunningOnAppVeyor)
@@ -185,7 +185,7 @@ Task("Publish-Release")
185185
{
186186
Name = version,
187187
Body = String.Join(Environment.NewLine, releaseNotes.Notes),
188-
Prerelease = releaseNotes.Version.ToString() == version,
188+
Prerelease = releaseNotes.Version.ToString() != version,
189189
TargetCommitish = "master",
190190
}).Wait();
191191
});

0 commit comments

Comments
 (0)