Skip to content

Commit

Permalink
Parametrize invalid argument test
Browse files Browse the repository at this point in the history
Added more tests for an invalid component argument:

* Downloader with a capital D to test that the component namae is case-sensitive and lowercase.
* uploader to test a completely unknown component, but in a valid (lowercase) format.
  • Loading branch information
Glutexo committed Nov 4, 2023
1 parent 96031e8 commit 643c10c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions test/onigumo_cli_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ defmodule OnigumoCLITest do
"http://onigumo.local/bye.html"
]

@invalid_arguments [
"Downloader",
"uploader"
]

describe("Onigumo.CLI.main/1") do
@tag :tmp_dir
test("run CLI with 'downloader' argument", %{tmp_dir: tmp_dir}) do
Expand All @@ -21,8 +26,10 @@ defmodule OnigumoCLITest do
Onigumo.CLI.main(["downloader"])
end

test("run CLI with invalid argument") do
assert_raise(MatchError, fn -> Onigumo.CLI.main(["Uploader"]) end)
for argument <- @invalid_arguments do
test("run CLI with invalid argument #{inspect(argument)}") do
assert_raise(MatchError, fn -> Onigumo.CLI.main([unquote(argument)]) end)
end
end

test("run CLI with no arguments") do
Expand Down

0 comments on commit 643c10c

Please sign in to comment.