mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-09-24 07:54:39 +00:00
Fix tests, update to 0.26
This commit is contained in:
4
.github/workflows/dotnetcore.yml
vendored
4
.github/workflows/dotnetcore.yml
vendored
@@ -12,9 +12,9 @@ jobs:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: 3.1.301
|
||||
dotnet-version: 3.1.302
|
||||
- run: dotnet run -p src/build/build.csproj
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: ${{ matrix.os }}-sharpcompress.nupkg
|
||||
name: ${{ matrix.os }}-sharpcompress.*nupkg
|
||||
path: artifacts/*
|
||||
|
||||
@@ -13,7 +13,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharpCompress", "src\SharpC
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharpCompress.Test", "tests\SharpCompress.Test\SharpCompress.Test.csproj", "{F2B1A1EB-0FA6-40D0-8908-E13247C7226F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "build", "src\build\build.csproj", "{D4D613CB-5E94-47FB-85BE-B8423D20C545}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "build", "build\build.csproj", "{D4D613CB-5E94-47FB-85BE-B8423D20C545}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -40,6 +40,5 @@ Global
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{FD19DDD8-72B2-4024-8665-0D1F7A2AA998} = {3C5BE746-03E5-4895-9988-0B57F162F86C}
|
||||
{F2B1A1EB-0FA6-40D0-8908-E13247C7226F} = {0F0901FF-E8D9-426A-B5A2-17C7F47C1529}
|
||||
{D4D613CB-5E94-47FB-85BE-B8423D20C545} = {3C5BE746-03E5-4895-9988-0B57F162F86C}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Bullseye" Version="3.3.0" />
|
||||
<PackageReference Include="Glob" Version="1.1.6" />
|
||||
<PackageReference Include="Glob" Version="1.1.7" />
|
||||
<PackageReference Include="SimpleExec" Version="6.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"sdk": {
|
||||
"version": "3.1.301"
|
||||
"version": "3.1.302"
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,9 @@
|
||||
<PropertyGroup>
|
||||
<AssemblyTitle>SharpCompress - Pure C# Decompression/Compression</AssemblyTitle>
|
||||
<NeutralLanguage>en-US</NeutralLanguage>
|
||||
<VersionPrefix>0.25.1</VersionPrefix>
|
||||
<AssemblyVersion>0.25.1</AssemblyVersion>
|
||||
<FileVersion>0.25.1</FileVersion>
|
||||
<VersionPrefix>0.26.0</VersionPrefix>
|
||||
<AssemblyVersion>0.26.0</AssemblyVersion>
|
||||
<FileVersion>0.26.0</FileVersion>
|
||||
<Authors>Adam Hathcock</Authors>
|
||||
<TargetFrameworks Condition="'$(LibraryFrameworks)'==''">netstandard2.0;netstandard2.1;net46</TargetFrameworks>
|
||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netstandard2.0;netstandard2.1</TargetFrameworks>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.2" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
<PackageReference Include="Xunit.SkippableFact" Version="1.4.8" />
|
||||
<PackageReference Include="Xunit.SkippableFact" Version="1.4.13" />
|
||||
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Writers.Tar;
|
||||
using Xunit;
|
||||
@@ -16,19 +17,19 @@ namespace SharpCompress.Test.Tar
|
||||
[Fact]
|
||||
public void Tar_Writer()
|
||||
{
|
||||
Write(CompressionType.None, "Tar.noEmptyDirs.tar", "Tar.noEmptyDirs.tar");
|
||||
Write(CompressionType.None, "Tar.noEmptyDirs.tar", "Tar.noEmptyDirs.tar", Encoding.GetEncoding(866));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Tar_BZip2_Writer()
|
||||
{
|
||||
Write(CompressionType.BZip2, "Tar.noEmptyDirs.tar.bz2", "Tar.noEmptyDirs.tar.bz2");
|
||||
Write(CompressionType.BZip2, "Tar.noEmptyDirs.tar.bz2", "Tar.noEmptyDirs.tar.bz2", Encoding.GetEncoding(866));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Tar_LZip_Writer()
|
||||
{
|
||||
Write(CompressionType.LZip, "Tar.noEmptyDirs.tar.lz", "Tar.noEmptyDirs.tar.lz");
|
||||
Write(CompressionType.LZip, "Tar.noEmptyDirs.tar.lz", "Tar.noEmptyDirs.tar.lz", Encoding.GetEncoding(866));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -188,9 +188,9 @@ namespace SharpCompress.Test
|
||||
Assert.Equal(fi1.Attributes, fi2.Attributes);
|
||||
}
|
||||
|
||||
protected void CompareArchivesByPath(string file1, string file2) {
|
||||
protected void CompareArchivesByPath(string file1, string file2, Encoding encoding = null) {
|
||||
ReaderOptions readerOptions = new ReaderOptions { LeaveStreamOpen = false };
|
||||
readerOptions.ArchiveEncoding.Default = Encoding.GetEncoding(866);
|
||||
readerOptions.ArchiveEncoding.Default = encoding ?? Encoding.Default;
|
||||
|
||||
//don't compare the order. OS X reads files from the file system in a different order therefore makes the archive ordering different
|
||||
var archive1Entries = new List<string>();
|
||||
|
||||
@@ -16,15 +16,15 @@ namespace SharpCompress.Test
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
protected void Write(CompressionType compressionType, string archive, string archiveToVerifyAgainst)
|
||||
protected void Write(CompressionType compressionType, string archive, string archiveToVerifyAgainst, Encoding encoding = null)
|
||||
{
|
||||
using (Stream stream = File.OpenWrite(Path.Combine(SCRATCH2_FILES_PATH, archive))) {
|
||||
WriterOptions writerOptions = new WriterOptions(compressionType)
|
||||
{
|
||||
LeaveStreamOpen = true,
|
||||
};
|
||||
|
||||
writerOptions.ArchiveEncoding.Default = Encoding.GetEncoding(866);
|
||||
|
||||
writerOptions.ArchiveEncoding.Default = encoding ?? Encoding.Default;
|
||||
|
||||
using (var writer = WriterFactory.Open(stream, type, writerOptions))
|
||||
{
|
||||
@@ -37,8 +37,8 @@ namespace SharpCompress.Test
|
||||
using (Stream stream = File.OpenRead(Path.Combine(SCRATCH2_FILES_PATH, archive)))
|
||||
{
|
||||
ReaderOptions readerOptions = new ReaderOptions();
|
||||
|
||||
readerOptions.ArchiveEncoding.Default = Encoding.GetEncoding(866);
|
||||
|
||||
readerOptions.ArchiveEncoding.Default = encoding ?? Encoding.Default;
|
||||
|
||||
using (var reader = ReaderFactory.Open(new NonDisposingStream(stream), readerOptions))
|
||||
{
|
||||
|
||||
@@ -168,7 +168,7 @@ namespace SharpCompress.Test.Zip
|
||||
|
||||
archive.SaveTo(scratchPath, writerOptions);
|
||||
}
|
||||
CompareArchivesByPath(modified, scratchPath);
|
||||
CompareArchivesByPath(modified, scratchPath, Encoding.GetEncoding(866));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -188,7 +188,7 @@ namespace SharpCompress.Test.Zip
|
||||
|
||||
archive.SaveTo(scratchPath, writerOptions);
|
||||
}
|
||||
CompareArchivesByPath(modified, scratchPath);
|
||||
CompareArchivesByPath(modified, scratchPath, Encoding.GetEncoding(866));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -286,7 +286,7 @@ namespace SharpCompress.Test.Zip
|
||||
|
||||
archive.SaveTo(scratchPath, writerOptions);
|
||||
}
|
||||
CompareArchivesByPath(unmodified, scratchPath);
|
||||
CompareArchivesByPath(unmodified, scratchPath, Encoding.GetEncoding(866));
|
||||
Directory.Delete(SCRATCH_FILES_PATH, true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user