Fix cross-platform WoT fixture paths and XML regeneration

Compose repository fixture paths from components so Linux and macOS do not
treat backslashes as filename characters. Emit deterministic LF pump XML
and pin its checkout representation, preserving byte-exact regeneration
assertions on every platform. Add a regression for the output line endings.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6a9f41b1-72f0-4c74-bd7f-26fa531e5738
This commit is contained in:
Marc
2026-09-07 09:26:52 +02:00
parent 5ddb7a0472
commit 278b092d8b
4 changed files with 16 additions and 4 deletions
+3
View File
@@ -20,6 +20,9 @@
# LF on every platform so the checked-out bytes are the upstream bytes.
*.jsonld text eol=lf
# The generated pump XML must match its checked-in bytes on every platform.
samples/WotCon/AggregationClient/Documents/SamplePump.NodeSet2.xml text eol=lf
# Denote all files that should not have line endings normalized, should not be
# merged, and should not show in a textual diff.
*.docm binary
@@ -392,7 +392,8 @@ namespace Opc.Ua.Types.Tests.Wot
directory = directory.Parent;
}
Assert.That(directory, Is.Not.Null);
using FileStream stream = File.OpenRead(Path.Combine(directory!.FullName, relativePath));
string sourcePath = Path.Combine(directory!.FullName, Path.Combine(relativePath.Split('\\')));
using FileStream stream = File.OpenRead(sourcePath);
UANodeSet source = UANodeSet.Read(stream)!;
var options = new WotNodeSetConverterOptions
{
@@ -419,7 +420,7 @@ namespace Opc.Ua.Types.Tests.Wot
using WotDocumentSet reloaded = Reload(set);
await AssertEquivalentAsync(source, reloaded, options).ConfigureAwait(false);
TestContext.Out.WriteLine(
$"{Path.GetFileName(relativePath)}: {set.Entries.Count} linked partitions, " +
$"{Path.GetFileName(sourcePath)}: {set.Entries.Count} linked partitions, " +
$"{set.Entries.ToArray().Count(entry => entry.Document.TryGetNativeProjection(out _))} native.");
}
@@ -126,13 +126,12 @@ namespace Opc.Ua.WotCon.Tests.Samples
Encoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false),
Indent = true,
IndentChars = " ",
NewLineChars = "\r\n",
NewLineChars = "\n",
NewLineHandling = NewLineHandling.Replace
}))
{
document.Save(writer);
}
stream.WriteByte(13);
stream.WriteByte(10);
return ByteString.From(stream.ToArray());
}
@@ -560,6 +560,15 @@ namespace Opc.Ua.WotCon.Tests.Samples
}
}
[Test]
public void GeneratedPumpSourceUsesLfLineEndings()
{
ByteString generated = WotAggregationDocumentGenerator.GeneratePumpNodeSetXml(PumpSourcePath);
Assert.That(generated.Span.IndexOf((byte)'\r'), Is.EqualTo(-1));
Assert.That(generated.Span[generated.Length - 1], Is.EqualTo((byte)'\n'));
}
[Test]
public void GeneratedPumpSourceRebuildsMissingDeclarationsAndTheSecondPump()
{