Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add unit tests that verify extended attribute and global extended att…
…ribute roundtripping when the value contains an '=' character.

Also add a null check for a subsequent GetNextEntry.
  • Loading branch information
carlossanlop committed Mar 1, 2023
commit 836abf9e62cebff48ade2dcea36ae96743213e5c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ public void ExtractGlobalExtendedAttributesEntry_Throws()
[InlineData(" key ", " value ")]
[InlineData(" key spaced ", " value spaced ")]
[InlineData("many sla/s\\hes", "/////////////\\\\\\///////////")]
[InlineData("key", "va=lue")]
[InlineData("key", "=")]
public void GlobalExtendedAttribute_Roundtrips(string key, string value)
{
var stream = new MemoryStream();
Expand All @@ -104,6 +106,7 @@ public void GlobalExtendedAttribute_Roundtrips(string key, string value)
PaxGlobalExtendedAttributesTarEntry entry = Assert.IsType<PaxGlobalExtendedAttributesTarEntry>(reader.GetNextEntry());
Assert.Equal(1, entry.GlobalExtendedAttributes.Count);
Assert.Equal(KeyValuePair.Create(key, value), entry.GlobalExtendedAttributes.First());
Assert.Null(reader.GetNextEntry());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ public void TarReader_LeaveOpen_False_CopiedDataNotDisposed()
[InlineData(" key ", " value ")]
[InlineData(" key spaced ", " value spaced ")]
[InlineData("many sla/s\\hes", "/////////////\\\\\\///////////")]
[InlineData("key", "va=lue")]
[InlineData("key", "=")]
public void PaxExtendedAttribute_Roundtrips(string key, string value)
{
var stream = new MemoryStream();
Expand All @@ -120,6 +122,7 @@ public void PaxExtendedAttribute_Roundtrips(string key, string value)
PaxTarEntry entry = Assert.IsType<PaxTarEntry>(reader.GetNextEntry());
Assert.Equal(5, entry.ExtendedAttributes.Count);
Assert.Contains(KeyValuePair.Create(key, value), entry.ExtendedAttributes);
Assert.Null(reader.GetNextEntry());
}
}
}
Expand Down