#!/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
    set -g __dpaste_send_url $dpaste_url
    assert_equal text (__dpaste_parse_expires -t never text)
    assert_equal "https://dpaste.de/api/?format=url&expires=never" $__dpaste_send_url
    set -g __dpaste_send_url $dpaste_url
    assert_equal text (__dpaste_parse_expires -t hour text)
    assert_equal "https://dpaste.de/api/?format=url&expires=3600" $__dpaste_send_url
    set -g __dpaste_send_url $dpaste_url
  end
end

if not set -q tank_running
  source (dirname (status -f))/helper.fish
  tank_run
end

#!/usr/bin/env fish

set -l script_dir (dirname (status -f))

function suite_dpaste
  function setup
    set -g __dpaste_expires_choises
    source $script_dir/../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
    set -g __dpaste_send_url $dpaste_url
    assert_equal text (__dpaste_parse_expires -t never text)
    assert_equal "https://dpaste.de/api/?format=url&expires=never" $__dpaste_send_url
    set -g __dpaste_send_url $dpaste_url
    assert_equal text (__dpaste_parse_expires -t hour text)
    assert_equal "https://dpaste.de/api/?format=url&expires=3600" $__dpaste_send_url
    set -g __dpaste_send_url $dpaste_url
  end
end

if not set -q tank_running
  source $script_dir/helper.fish
  tank_run
end

Allow test run with any working directory
[dpaste] Allow test run with any working directory

oranja/oh-my-fish,oh-my-fish/oh-my-fish-legacy,wfscheper/oh-my-fish,lfiolhais/oh-my-fish,oranja/oh-my-fish,ovstetun/oh-my-fish,vukk/oh-my-fish,jeremiejig/oh-my-fish,lfiolhais/oh-my-fish,hfs/oh-my-fish,setswei/oh-my-fish,marcker/oh-my-fish,wfscheper/oh-my-fish,nelsonjchen/oh-my-fish,sheldon/oh-my-fish,cap10morgan/oh-my-fish,eugenesvk/oh-my-fish,eugenesvk/oh-my-fish,hfs/oh-my-fish,sysbot/oh-my-fish,bbatsche/oh-my-fish,oh-my-fish/oh-my-fish,VANITAX/oh-my-fish,scorphus/oh-my-fish-screwed,gblmarquez/oh-my-fish,MaicoTimmerman/oh-my-fish,VANITAX/oh-my-fish,scorphus/oh-my-fish,scorphus/oh-my-fish,marcker/oh-my-fish,joseluisq/oh-my-fish,Pyppe/oh-my-fish,bobthecow/oh-my-fish,ohspite/oh-my-fish,bbatsche/oh-my-fish,nwykes/oh-my-fish,oh-my-fish/oh-my-fish,chgu82837/oh-my-fish,wangyung/oh-my-fish,wangyung/oh-my-fish,nwykes/oh-my-fish,MaicoTimmerman/oh-my-fish,bsott/oh-my-fish,l371559739/oh-my-fish,jeremiejig/oh-my-fish,jsmestad/oh-my-fish,bsott/oh-my-fish