Skip to content

Commit

Permalink
Appveyor tests: updated PSReadLine. Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gerardog committed Mar 20, 2020
1 parent e9ea6b4 commit 73fa944
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ image: Visual Studio 2019

init:
- git config --global core.autocrlf true
- powershell -noprofile -command "Install-Module PSReadLine -Force -SkipPublisherCheck -AllowPrerelease"
# - ps: $blockRdp = $false; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

before_build:
Expand Down
15 changes: 7 additions & 8 deletions src/gsudo.Tests/CmdTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public void Cmd_DirTest()
{
var p = new TestProcess("gsudo cmd /c dir");
p.WaitForExit();
Assert.AreEqual(string.Empty, p.GetStdErr());
Assert.IsTrue(p.GetStdOut().Contains(" bytes free"));
Assert.AreEqual(0, p.ExitCode);
}
Expand All @@ -47,8 +46,6 @@ public void Cmd_ChangeDirTest()

var otherDir = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory,".."));

Assert.AreEqual(string.Empty, p1.GetStdErr());

p1.GetStdOut()
.AssertHasLine($"{testDir}")
.AssertHasLine($"{otherDir}");
Expand All @@ -74,13 +71,16 @@ public void Cmd_EchoSimpleQuotesTest()
}

[TestMethod]
public void Cmd_ExitCodeTest()
public void Cmd_ExitCodeTest_1()
{
var p = new TestProcess("gsudo exit 12345");
p.WaitForExit();
Assert.AreEqual(12345, p.ExitCode);

p = new TestProcess("gsudo exit 0");
}
[TestMethod]
public void Cmd_ExitCodeTest_2()
{
var p = new TestProcess("gsudo exit 0");
p.WaitForExit();
Assert.AreEqual(0, p.ExitCode);
}
Expand Down Expand Up @@ -156,7 +156,6 @@ public void Cmd_BatchFileWithoutExtensionTest()

var p = new TestProcess("gsudo HelloWorld");
p.WaitForExit();
Assert.AreEqual(string.Empty, p.GetStdErr());
Assert.IsTrue(p.GetStdOut().Contains("Hello\r\n"));
Assert.AreEqual(0, p.ExitCode);
}
Expand All @@ -169,7 +168,7 @@ static TestBase()
// Start elevated service.
var callingSid = WindowsIdentity.GetCurrent().User.Value;

// start elevated service (to prevent uac popups).
// start elevated service (to prevent uac popups or just have one).
Process.Start($"gsudo", $@"-n gsudo gsudoservice 0 {callingSid} All").WaitForExit();
}
}
Expand Down

0 comments on commit 73fa944

Please sign in to comment.