# file      : tests/test/script/builtin/ln.testscript
# license   : MIT; see accompanying LICENSE file

.include ../common.testscript

: file
:
: Test creating a file symlink.
:
{
  : cleanup
  :
  $c <<EOI && $b
    touch a;
    ln -s a b
    EOI

  : no-cleanup
  :
  $c <<EOI && $b
    touch a;
    ln -s --no-cleanup a b;
    rm b
    EOI
}

: dir
:
: Test creating a directory symlink.
:
{
  : cleanup
  :
  $c <<EOI && $b
    mkdir a;
    touch a/b;
    ln -s a c
    EOI

  : no-cleanup
  :
  $c <<EOI && $b
    mkdir a;
    touch a/b;
    ln -s --no-cleanup a c;
    rm -r c
    EOI
}

: multiple-targets
:
: Test creating links for multiple targets in the specified directory.
:
{
  : cleanup
  :
  $c <<EOI && $b
    mkdir b c;
    touch a b/c;
    ln -s ../a ../b c/
    EOI

  : no-cleanup
  :
  $c <<EOI && $b
    mkdir b c;
    touch a b/c;
    ln -s --no-cleanup ../a ../b c/;
    rm -r c/a c/b
    EOI
}