mirror of
https://github.com/oh-my-fish/oh-my-fish
synced 2024-11-03 15:40:32 +00:00
[dpaste] Add tests
This commit is contained in:
parent
32c1a02690
commit
4cb6539197
7
plugins/dpaste/tests/helper.fish
Normal file
7
plugins/dpaste/tests/helper.fish
Normal file
@ -0,0 +1,7 @@
|
||||
set -l fish_tank /usr/local/share/fish-tank/tank.fish
|
||||
if not test -e $fish_tank
|
||||
echo 'error: fish-tank is required to run these tests (https://github.com/terlar/fish-tank)'
|
||||
exit 1
|
||||
end
|
||||
|
||||
source $fish_tank
|
23
plugins/dpaste/tests/test_dpaste.fish
Executable file
23
plugins/dpaste/tests/test_dpaste.fish
Executable file
@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env fish
|
||||
|
||||
function suite_dpaste
|
||||
function setup
|
||||
set -g __dpaste_expires_choises
|
||||
source ../dpaste.fish
|
||||
__dpaste_set_defaults
|
||||
end
|
||||
|
||||
function test_dpaste_parse_expires
|
||||
assert_equal text (__dpaste_parse_expires text)
|
||||
assert_equal "https://dpaste.de/api/?format=url" $__dpaste_send_url
|
||||
assert_equal text (__dpaste_parse_expires -t never text)
|
||||
assert_equal "https://dpaste.de/api/?format=url&expires=never" $__dpaste_send_url
|
||||
assert_equal text (__dpaste_parse_expires -t hour 3600)
|
||||
assert_equal "https://dpaste.de/api/?format=url&expires=" $__dpaste_send_url
|
||||
end
|
||||
end
|
||||
|
||||
if not set -q tank_running
|
||||
source (dirname (status -f))/helper.fish
|
||||
tank_run
|
||||
end
|
Loading…
Reference in New Issue
Block a user