Files
Il2CppInspectorRedux/Il2CppTests/generate-tests.ps1
2020-12-21 05:53:58 +01:00

40 lines
831 B
PowerShell

# Copyright 2019-2020 Katy Coe - http://www.djkaty.com - https://github.com/djkaty
# All rights reserved.
# Generate Tests.cs
$testGen = "$PSScriptRoot/Tests.cs"
$bin = "$PSScriptRoot/TestBinaries"
echo @"
// THIS FILE IS AUTO-GENERATED BY GENERATE-TESTS.PS1
// DO NOT EDIT
using System.Threading.Tasks;
using NUnit.Framework;
namespace Il2CppInspector
{
[Parallelizable(ParallelScope.All)]
public partial class TestRunner
{
"@ > $testGen
gci -Directory $bin | % {
$loadOptionsFile = "$($_.FullName)\loadoptions.txt"
$loadOptions = ""
if (Test-Path $loadOptionsFile -PathType Leaf) {
$loadOptions = cat $loadOptionsFile
}
echo @"
[Test]
public async Task $($_.Name -Replace '\W','_')() {
await runTest(@"$($_.FullName)", new LoadOptions { $loadOptions });
}
"@ >> $testGen
}
echo @"
}
}
"@ >> $testGen