Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
Patch osx tests
Browse files Browse the repository at this point in the history
  • Loading branch information
caesay committed Dec 26, 2023
1 parent c066373 commit 35339ea
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ jobs:
path: src/Rust/target/release

- name: Build .NET
run: dotnet build -c Release
run: dotnet build -c Release /p:PackRustAssets=true

- name: Upload Package Artifacts
uses: actions/upload-artifact@v3
Expand Down
8 changes: 5 additions & 3 deletions src/Squirrel.Csq/Squirrel.Csq.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@
</ItemGroup>

<ItemGroup Condition="'$(Configuration)' == 'Debug'">
<None Include="..\Rust\target\debug\update.exe" CopyToOutputDirectory="Always" />
<None Include="..\Rust\target\debug\setup.exe" CopyToOutputDirectory="Always" />
<None Include="..\Rust\target\debug\update" CopyToOutputDirectory="Always" Condition="$([MSBuild]::IsOSPlatform('OSX'))" />
<None Include="..\Rust\target\debug\update.exe" CopyToOutputDirectory="Always" Condition="$([MSBuild]::IsOSPlatform('Windows'))" />
<None Include="..\Rust\target\debug\setup.exe" CopyToOutputDirectory="Always" Condition="$([MSBuild]::IsOSPlatform('Windows'))" />
<None Include="..\..\vendor\rcedit.exe" CopyToOutputDirectory="Always" />
<None Include="..\..\vendor\signtool.exe" CopyToOutputDirectory="Always" />
<None Include="..\..\Squirrel.entitlements" CopyToOutputDirectory="Always" />
</ItemGroup>

<ItemGroup Condition="'$(Configuration)' == 'Release'">
<ItemGroup Condition="'$(PackRustAssets)' == 'true'">
<None Include="..\Rust\target\release\updatemac" Pack="true" PackagePath="vendor" />
<None Include="..\Rust\target\release\update.exe" Pack="true" PackagePath="vendor" />
<None Include="..\Rust\target\release\setup.exe" Pack="true" PackagePath="vendor" />
<None Include="..\..\vendor\rcedit.exe" Pack="true" PackagePath="vendor" />
Expand Down
4 changes: 4 additions & 0 deletions src/Squirrel/ReleaseEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ public static ReleaseEntry ParseReleaseEntry(string entry)
throw new Exception("Filename can either be an absolute HTTP[s] URL, *or* a file name");
}

if (filename.IndexOfAny(new[] { '\"', '/', '\\', '<', '>', '|', '\0' }) > -1) {
throw new Exception("Filename can either be an absolute HTTP[s] URL, *or* a file name");
}

long size = Int64.Parse(m.Groups[3].Value);
return new ReleaseEntry(m.Groups[1].Value, filename, size, baseUrl, query, stagingPercentage);
}
Expand Down
9 changes: 6 additions & 3 deletions test/Squirrel.Tests/UtilityTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public UtilityTests(ITestOutputHelper output)
_output = output;
}

[Theory]
[SkippableTheory]
[InlineData("file.txt", "file.txt")]
[InlineData("file", "file")]
[InlineData("/file", "\\file")]
Expand All @@ -33,12 +33,13 @@ public UtilityTests(ITestOutputHelper output)
[InlineData("C:/AnApp/file/", "C:\\AnApp\\file")]
public void PathIsNormalized(string input, string expected)
{
Skip.IfNot(SquirrelRuntimeInfo.IsWindows);
var exp = Path.GetFullPath(expected);
var normal = Utility.NormalizePath(input);
Assert.Equal(exp, normal);
}

[Theory]
[SkippableTheory]
[InlineData("C:\\AnApp", "C:\\AnApp\\file.exe", true)]
[InlineData("C:\\AnApp\\", "C:\\AnApp\\file.exe", true)]
[InlineData("C:\\AnApp", "C:\\AnApp\\sub\\dir\\file.exe", true)]
Expand All @@ -50,6 +51,7 @@ public void PathIsNormalized(string input, string expected)
[InlineData("AnAppThree", "AnAppThree\\file.exe", true)]
public void FileIsInDirectory(string directory, string file, bool isIn)
{
Skip.IfNot(SquirrelRuntimeInfo.IsWindows);
var fileInDir = Utility.IsFileInDirectory(file, directory);
Assert.Equal(isIn, fileInDir);
}
Expand Down Expand Up @@ -172,13 +174,14 @@ public void FileIsLikelyPEImageTest(string input, bool result)
Assert.Equal(result, Utility.FileIsLikelyPEImage(input));
}

[Theory]
[SkippableTheory]
[InlineData("C:\\Users\\bob\\temp\\pkgPath\\lib\\net45\\foo.exe", "C:\\Users\\bob\\temp\\pkgPath", true)]
[InlineData("C:\\Users\\bob\\temp\\pkgPath\\lib\\net45\\node_modules\\foo.exe", "C:\\Users\\bob\\temp\\pkgPath", false)]
[InlineData("C:\\Users\\bob\\temp\\pkgPath\\lib\\net45\\node_modules\\foo\\foo.exe", "C:\\Users\\bob\\temp\\pkgPath", false)]
[InlineData("foo.png", "C:\\Users\\bob\\temp\\pkgPath", false)]
public void IsFileTopLevelInPackageTest(string input, string packagePath, bool result)
{
Skip.IfNot(SquirrelRuntimeInfo.IsWindows);
Assert.Equal(result, Utility.IsFileTopLevelInPackage(input, packagePath));
}

Expand Down

0 comments on commit 35339ea

Please sign in to comment.