Fix bad test case

This commit is contained in:
Dominion
2022-10-09 10:30:55 -04:00
parent a57f032ce4
commit f72955cbc6
@@ -40,24 +40,22 @@ namespace Tgstation.Server.Host.IO.Tests
var tmpFile = Path.GetTempFileName();
try
{
Assert.IsFalse(postWriteHandler.NeedsPostWrite(tmpFile));
postWriteHandler.HandleWrite(tmpFile);
if (isWindows)
return; //you do nothing
//ensure it is now executable
Assert.IsTrue(postWriteHandler.NeedsPostWrite(tmpFile));
File.WriteAllBytes(tmpFile, Encoding.UTF8.GetBytes("#!/bin/sh\n"));
Assert.IsFalse(postWriteHandler.NeedsPostWrite(tmpFile));
using (var process = Process.Start(tmpFile))
{
process.WaitForExit();
Assert.AreEqual(0, process.ExitCode);
}
Assert.IsTrue(postWriteHandler.NeedsPostWrite(tmpFile));
//run it again for the code coverage on that part where no changes are made if it's already executable
postWriteHandler.HandleWrite(tmpFile);
}