Improve doc and only use doctest
This commit is contained in:
parent
1ca48d5817
commit
adc39a0523
2 changed files with 3 additions and 13 deletions
|
@ -10,14 +10,12 @@ defmodule HahaYes.Utility do
|
|||
|
||||
```
|
||||
iex> HahaYes.Utility.download("https://x.com/i/status/1844841048603783249", "#{System.tmp_dir}/test")
|
||||
|
||||
{:ok, /tmp}/test.mp4
|
||||
{:ok, "#{System.tmp_dir}/test.mp4"}
|
||||
```
|
||||
|
||||
```
|
||||
iex> HahaYes.Utility.download("invalid", "#{System.tmp_dir}/test")
|
||||
|
||||
{:error, "[generic] Extracting URL: invalid\\nERROR: [generic] 'invalid' is not a valid URL. Set --default-search "ytsearch" (or run yt-dlp "ytsearch:invalid" ) to search YouTube"}
|
||||
iex> HahaYes.Utility.download("http://example.com", "#{System.tmp_dir}/test")
|
||||
{:error,"[generic] Extracting URL: http://example.com\\n[generic] example: Downloading webpage\\n[generic] example: Extracting information\\nERROR: Unsupported URL: http://example.com\\n"}
|
||||
```
|
||||
"""
|
||||
|
||||
|
|
|
@ -1,12 +1,4 @@
|
|||
defmodule HahaYesTest do
|
||||
use ExUnit.Case
|
||||
doctest HahaYes.Utility
|
||||
|
||||
@tag :tmp_dir
|
||||
|
||||
test "download utils", %{tmp_dir: tmp_dir} do
|
||||
assert HahaYes.Utility.download("https://x.com/i/status/1844841048603783249", "#{tmp_dir}/test") == {:ok, "#{tmp_dir}/test.mp4"}
|
||||
|
||||
assert HahaYes.Utility.download("invalid", "#{tmp_dir}/test") == {:error, "[generic] Extracting URL: invalid\nERROR: [generic] 'invalid' is not a valid URL. Set --default-search \"ytsearch\" (or run yt-dlp \"ytsearch:invalid\" ) to search YouTube\n"}
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue