Skip to content

Commit 9908165

Browse files
committed
Slightly improve code coverage
1 parent f01ab96 commit 9908165

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/DiffLib/DiffOptions.cs

+2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
using System;
2+
using System.Diagnostics.CodeAnalysis;
23

34
namespace DiffLib;
45

56
/// <summary>
67
/// This class is used to specify options to the diff algorithm.
78
/// </summary>
9+
[ExcludeFromCodeCoverage]
810
public record struct DiffOptions()
911
{
1012
private readonly int _ContextSize = 1;

tests/DiffLib.Tests/OptionTests.cs

+20
Original file line numberDiff line numberDiff line change
@@ -291,4 +291,24 @@ public void ToString_OfDefaultOption_ReturnsEmptyString()
291291

292292
Assert.That(s, Is.SameAs(string.Empty));
293293
}
294+
295+
[Test]
296+
public void GetValueOrDefault_WithValue_ReturnsValue()
297+
{
298+
var o = new Option<int>(10);
299+
300+
int output = o.GetValueOrDefault();
301+
302+
Assert.That(output, Is.EqualTo(10));
303+
}
304+
305+
[Test]
306+
public void GetValueOrDefault_WithoutValue_ReturnsDefault()
307+
{
308+
var o = default(Option<int>);
309+
310+
int output = o.GetValueOrDefault();
311+
312+
Assert.That(output, Is.EqualTo(0));
313+
}
294314
}

0 commit comments

Comments
 (0)