Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Feb 19, 2023
2 parents 8505862 + aa2df5b commit 58a1117
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/Verify.Tests/Naming/NamerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,14 @@ public Task MultipleTargetWithDuplicateName() =>
new Target("txt", "data", "theNameA")
});

[Fact]
public void DistinctUniquenessPrefixes()
{
var list = new UniquenessList();
list.Add("foo");
list.Add("foo");
Assert.Equal(".foo", list.ToString());

[Fact]
public Task FrameworkName()
{
Expand Down
9 changes: 7 additions & 2 deletions src/Verify/Naming/UniquenessList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ public UniquenessList() =>
public UniquenessList(UniquenessList value) =>
inner = new(value.inner);

public void Add(string value) =>
inner.Add(value);
public void Add(string value)
{
if (!inner.Contains(value))
{
inner.Add(value);
}
}

public override string ToString()
{
Expand Down

0 comments on commit 58a1117

Please sign in to comment.