From dd91016ad6f203263cc04aa2f0fa2418030c5c65 Mon Sep 17 00:00:00 2001 From: Ikiru Yoshizaki <3856350+guitarrapc@users.noreply.github.com> Date: Tue, 17 Dec 2024 18:54:23 +0900 Subject: [PATCH] chore: skip on empty input --- src/Actions.Tests/FileExistsCommandTest.cs | 4 ++-- src/Actions/Commands/FileExsistsCommand.cs | 4 +--- src/Actions/Program.cs | 1 + 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Actions.Tests/FileExistsCommandTest.cs b/src/Actions.Tests/FileExistsCommandTest.cs index 4616495..0b2c5a3 100644 --- a/src/Actions.Tests/FileExistsCommandTest.cs +++ b/src/Actions.Tests/FileExistsCommandTest.cs @@ -5,10 +5,10 @@ namespace Actions.Tests; public class FileExistsCommandTest { [Fact] - public void EmptyPathTest() + public void SkipEmptyPathTest() { var command = new FileExsistsCommand(""); - Assert.Throws(() => command.Validate()); + command.Validate(); } [Fact] diff --git a/src/Actions/Commands/FileExsistsCommand.cs b/src/Actions/Commands/FileExsistsCommand.cs index b55441e..e9ac56d 100644 --- a/src/Actions/Commands/FileExsistsCommand.cs +++ b/src/Actions/Commands/FileExsistsCommand.cs @@ -6,9 +6,7 @@ public void Validate() { // do nothing for empty input if (string.IsNullOrWhiteSpace(pathPattern)) - { - throw new ActionCommandException("Input path was empty."); - } + return; // Handle glob path pattern. // /foo/bar/**/* diff --git a/src/Actions/Program.cs b/src/Actions/Program.cs index 2cf68a0..3aa54fc 100644 --- a/src/Actions/Program.cs +++ b/src/Actions/Program.cs @@ -68,6 +68,7 @@ public void ValidateFileExists(string pathPattern) Console.WriteLine($"Validating path, {pathPattern}"); var command = new FileExsistsCommand(pathPattern); command.Validate(); + Console.WriteLine($"Completed ..."); }