From f425aaafc6163dda051b5884fe68adcee2aba50c Mon Sep 17 00:00:00 2001 From: Sven Groot Date: Wed, 29 Nov 2023 14:33:15 -0800 Subject: [PATCH] Test without cancellation token. --- src/Ookii.CommandLine.Tests/CommandTypes.cs | 2 +- src/Ookii.CommandLine.Tests/SubCommandTest.cs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Ookii.CommandLine.Tests/CommandTypes.cs b/src/Ookii.CommandLine.Tests/CommandTypes.cs index fa1f14d..80e33d1 100644 --- a/src/Ookii.CommandLine.Tests/CommandTypes.cs +++ b/src/Ookii.CommandLine.Tests/CommandTypes.cs @@ -115,7 +115,7 @@ public int Run() public async Task RunAsync(CancellationToken cancellationToken) { await Task.Delay(Value, cancellationToken); - return 0; + return 10; } } diff --git a/src/Ookii.CommandLine.Tests/SubCommandTest.cs b/src/Ookii.CommandLine.Tests/SubCommandTest.cs index 2185c71..6de3875 100644 --- a/src/Ookii.CommandLine.Tests/SubCommandTest.cs +++ b/src/Ookii.CommandLine.Tests/SubCommandTest.cs @@ -353,6 +353,9 @@ public async Task TestAsyncCancelableCommand(ProviderKind kind) var manager = CreateManager(kind); await Assert.ThrowsExceptionAsync( async () => await manager.RunCommandAsync(["AsyncCancelableCommand", "10000"], source.Token)); + + // Command works if not passed a token. + Assert.AreEqual(10, await manager.RunCommandAsync(["AsyncCancelableCommand", "10"])); }