Skip to content
This repository has been archived by the owner on Mar 17, 2023. It is now read-only.

Added test for args length to subcommand #53

Merged
merged 1 commit into from
Jan 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions subcommands/subcommand_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,27 @@ func TestSubCommandUnknownSC(t *testing.T) {
}
}
}

func TestLengthArgs(t *testing.T) {
//Create a mock subcommand
msc := NewMockSC()

//Set the error message
msc.ErrorMsg = "Test error is being throw properly if the length of the args variable is < 1"

//Create an argument array
args := []string{}

//Create an array of Runner interface containing the mock subcommand
scmds := []Runner{
msc,
}

//Run the SubCommand function
err := SubCommand(args, scmds)

//Should have an error
if err == nil {
t.Fatalf("SubCommand: Expected to have error: %s | Received No Error", msc.ErrorMsg)
}
}