Skip to content

Commit

Permalink
add a simple test target to check for proper parsing of bad arguments
Browse files Browse the repository at this point in the history
note that parsing of the right arguments already happens in other unit
tests

This invokation method appears to work on both windows and linux
  • Loading branch information
bpkroth committed Sep 29, 2020
1 parent 82aea30 commit 2ec178a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions source/Mlos.Agent.Server/Mlos.Agent.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,14 @@
<Compile Include="TargetProcessManager.cs" />
</ItemGroup>
<Import Project="$(BaseDir)\build\Mlos.NetCore.targets" />
<Target Name="TestBadCliArgs" AfterTargets="Build" Condition="'$(RunUnitTest)' != 'false'">
<Exec Command="dotnet &quot;$(OutputPath)/$(TargetName).dll&quot; unhandled-arg" IgnoreExitCode="true" IgnoreStandardErrorWarningFormat="true" StandardOutputImportance="low" StandardErrorImportance="low">
<Output TaskParameter="ExitCode" PropertyName="UnhandledArgExitCode" />
</Exec>
<Error Text="CLI parser failed to error on unhandled arguments." Condition="'$(UnhandledArgExitCode)' != '1'" />
<Exec Command="dotnet &quot;$(OutputPath)/$(TargetName).dll&quot; --unhandled-opt" IgnoreExitCode="true" IgnoreStandardErrorWarningFormat="true" StandardOutputImportance="low" StandardErrorImportance="low">
<Output TaskParameter="ExitCode" PropertyName="UnhandledOptExitCode" />
</Exec>
<Error Text="CLI parser failed to error on unhandled options." Condition="'$(UnhandledOptExitCode)' != '1'" />
</Target>
</Project>

0 comments on commit 2ec178a

Please sign in to comment.