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

.include ../common.testscript

: dir
:
{{
  : cleanup
  :
  $c <<EOI && $b
    mkdir a b
    EOI

  : no-cleanup
  :
  : Also test that `--` is handled properly.
  :
  $c <<EOI && $b
    mkdir --no-cleanup -- --no-cleanup;
    rmdir -- --no-cleanup
    EOI
}}

: parent
:
{{
  : cleanup
  :
  $c <<EOI && $b
    mkdir -p a/b
    EOI

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

: syntax-1
:
{{
  b = [cmdline] $regex.apply($b, '(.+testscript.syntax).+', "\1 = 1'")

  : dir
  :
  {{
    : cleanup
    :
    $c <<EOI && $b
      mkdir a b
      EOI

    : no-cleanup
    :
    : Also test that `--` is handled properly.
    :
    $c <<EOI && $b
      mkdir --no-cleanup -- --no-cleanup;
      rmdir -- --no-cleanup
      EOI
  }}

  : parent
  :
  {{
    : cleanup
    :
    $c <<EOI && $b
      mkdir -p a/b
      EOI

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