# file      : tests/test/script/builtin/cat.test
# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
# license   : MIT; see accompanying LICENSE file

.include ../common.test

: in
:
$c <<EOI;
cat <<EOF >>EOO
foo
bar
EOF
foo
bar
EOO
EOI
$b

: dash
:
$c <<EOI;
cat - <<EOF >>EOO
foo
bar
EOF
foo
bar
EOO
EOI
$b

: file
:
$c <<EOI;
cat <<EOF >>>out;
foo
bar
EOF
cat out >>EOO
foo
bar
EOO
EOI
$b

: in-repeat
:
$c <<EOI;
cat - <<EOF >>EOO
foo
bar
EOF
foo
bar
EOO
EOI
$b

: non-existent
:
$c <<EOI;
cat in 2>>~%EOE% != 0
%cat: unable to print '.+[/\\]test[/\\]cat[/\\]non-existent[/\\]test[/\\]1[/\\]in': .+%
EOE
EOI
$b

: empty-path
:
: Cat an empty path.
:
$c <<EOI;
cat '' 2>"cat: invalid path ''" == 1
EOI
$b

# @@ When piping is ready test cat on a big file to test it is asynchronous.
#