mkdir symlink/reallylongdir
[symlink] symlink symlink/reallylongdir/symlink-file -> modify/ext-shebang.sh
[symlink] symlink symlink/symlink-dir -> symlink/reallylongdir
[symlink] symlink symlink/symlink-none -> symlink/reallylongdir/nonexistent

shfmt -f .
cmpenv stdout find.golden
! stderr .

# try to format missing paths
! shfmt nonexistent
stderr -count=1 nonexistent

! shfmt nonexistent-1 nonexistent-2 nonexistent-3
stderr -count=1 nonexistent-1
stderr -count=1 nonexistent-2
stderr -count=1 nonexistent-3

# format an entire directory without -l or -w
! shfmt .
stdout 'foo'
stdout 'bin/env'
stderr -count=1 'parse-error\.sh'

# format an entire directory with -l and -w
! shfmt -l -w .
cmpenv stdout modify.golden
stderr -count=1 'parse-error\.sh'

# parse-error again, but now as a lone file
! shfmt error/parse-error.sh
stderr -count=1 'parse-error\.sh'

# format files directly which we would ignore when walking directories
shfmt none/ext-shebang.other
stdout 'foo'
shfmt none/noext-noshebang
stdout 'foo'

# -f on files should still check extension and shebang
shfmt -f modify/ext.sh modify/shebang-1 none/ext-shebang.other none/noext-noshebang
stdout -count=2 '^modify'
! stdout '^none'

-- find.golden --
error${/}parse-error.sh
modify${/}dir${/}ext.sh
modify${/}ext-shebang.sh
modify${/}ext.bash
modify${/}ext.sh
modify${/}shebang-1
modify${/}shebang-2
modify${/}shebang-3
modify${/}shebang-4
modify${/}shebang-5
modify${/}shebang-args
modify${/}shebang-space
modify${/}shebang-tabs
-- modify.golden --
modify${/}dir${/}ext.sh
modify${/}ext-shebang.sh
modify${/}ext.bash
modify${/}ext.sh
modify${/}shebang-1
modify${/}shebang-2
modify${/}shebang-3
modify${/}shebang-4
modify${/}shebang-5
modify${/}shebang-args
modify${/}shebang-space
modify${/}shebang-tabs
-- modify/shebang-1 --
#!/bin/sh
 foo
-- modify/shebang-2 --
#!/bin/bash
 foo
-- modify/shebang-3 --
#!/usr/bin/sh
 foo
-- modify/shebang-4 --
#!/usr/bin/env bash
 foo
-- modify/shebang-5 --
#!/bin/env sh
 foo
-- modify/shebang-space --
#! /bin/sh
 foo
-- modify/shebang-tabs --
#!	/bin/env	sh
 foo
-- modify/shebang-args --
#!/bin/bash -e -x
 foo
-- modify/ext.sh --
 foo
-- modify/ext.bash --
 foo
-- modify/ext-shebang.sh --
#!/bin/sh
 foo
-- modify/dir/ext.sh --
foo

-- none/.hidden --
foo long enough
-- none/.hidden-shebang --
#!/bin/sh
 foo
-- none/..hidden-shebang --
#!/bin/sh
 foo
-- none/noext-empty --
foo
-- none/noext-noshebang --
foo long enough
-- none/shebang-nonewline --
#!/bin/shfoo
-- none/ext.other --
foo
-- none/empty --
-- none/ext-shebang.other --
#!/bin/sh
 foo
-- none/shebang-nospace --
#!/bin/envsh
 foo

-- skip/.git/ext.sh --
foo
-- skip/.svn/ext.sh --
foo
-- skip/.hg/ext.sh --
foo

-- error/parse-error.sh --
foo(
