77 lines · plain
1## Test cat command with a single file.2# RUN: rm -rf %t3# RUN: mkdir -p %t4# RUN: echo "abcdefgh" > %t/temp.write5# RUN: cat %t/temp.write > %t/tempcat.write6# RUN: %{python} %S/../check_path.py file %t/tempcat.write > %t/path.out7# RUN: FileCheck --check-prefix=FILE-EXISTS < %t/path.out %s8# RUN: FileCheck --check-prefix=CAT-OUTPUT --implicit-check-not={{.}} \9# RUN: --match-full-lines --strict-whitespace < %t/tempcat.write %s10# FILE-EXISTS: True11# CAT-OUTPUT:abcdefgh12 13## Test cat command with multiple files.14# RUN: rm -rf %t15# RUN: mkdir -p %t16# RUN: echo "abcdefgh" > %t/temp1.write17# RUN: echo "efghijkl" > %t/temp2.write18# RUN: echo "mnopqrst" > %t/temp3.write19# RUN: cat %t/temp1.write %t/temp2.write %t/temp3.write > %t/tempmulticat.write20# RUN: %{python} %S/../check_path.py file %t/tempmulticat.write > %t/path.out21# RUN: FileCheck --check-prefix=MULTI-FILE-EXISTS < %t/path.out %s22# RUN: FileCheck --check-prefix=MULTI-CAT-OUTPUT --implicit-check-not={{.}} \23# RUN: --match-full-lines --strict-whitespace < %t/tempmulticat.write %s24# MULTI-FILE-EXISTS: True25# MULTI-CAT-OUTPUT:abcdefgh26# MULTI-CAT-OUTPUT-NEXT:efghijkl27# MULTI-CAT-OUTPUT-NEXT:mnopqrst28 29## Test cat command with multiple files and piped output to FileCheck.30# RUN: rm -rf %t31# RUN: mkdir -p %t32# RUN: echo "abcdefgh" > %t/temp1.write33# RUN: echo "efghijkl" > %t/temp2.write34# RUN: cat %t/temp1.write %t/temp2.write | \35# RUN: FileCheck --check-prefix=PIPED-CAT-OUTPUT --implicit-check-not={{.}} \36# RUN: --match-full-lines --strict-whitespace %s37# PIPED-CAT-OUTPUT:abcdefgh38# PIPED-CAT-OUTPUT-NEXT:efghijkl39 40## Test cat command with multiple files and glob expressions.41# RUN: rm -rf %t42# RUN: mkdir -p %t43# RUN: echo "cvbnm" > %t/temp1.write44# RUN: echo "qwerty" > %t/temp2.write45# RUN: cat %t/*.write | \46# RUN: FileCheck --check-prefix=GLOB-CAT-OUTPUT --implicit-check-not={{.}} \47# RUN: --match-full-lines --strict-whitespace %s48# GLOB-CAT-OUTPUT:cvbnm49# GLOB-CAT-OUTPUT-NEXT:qwerty50 51## Test cat command with -v and --show-nonprinting option.52## The -v/--show-nonprinting options format text input into ^ and M- notation53# RUN: cat -v %S/cat_nonprinting.bin | \54# RUN: FileCheck --check-prefix=NP-CAT-OUTPUT --implicit-check-not={{.}} \55# RUN: --match-full-lines --strict-whitespace %s56# RUN: cat --show-nonprinting %S/cat_nonprinting.bin | \57# RUN: FileCheck --check-prefix=NP-CAT-OUTPUT --implicit-check-not={{.}} \58# RUN: --match-full-lines --strict-whitespace %s59# NP-CAT-OUTPUT:^@^A^B^C^D^E^F^G ^H60# NP-CAT-OUTPUT-NEXT:^K^L^M^N^O^P^Q^R^S61# NP-CAT-OUTPUT-NEXT:^T^U^V^W^X^Y^Z^[^\^]^^^_ !"#$%&'62# NP-CAT-OUTPUT-NEXT:()*+,-./0123456789:;63# NP-CAT-OUTPUT-NEXT:<=>?@ABCDEFGHIJKLMNO64# NP-CAT-OUTPUT-NEXT:PQRSTUVWXYZ[\]^_`abc65# NP-CAT-OUTPUT-NEXT:defghijklmnopqrstuvw66# NP-CAT-OUTPUT-NEXT:xyz{|}~^?M-^@M-^AM-^BM-^CM-^DM-^EM-^FM-^GM-^HM-^IM-^JM-^K67# NP-CAT-OUTPUT-NEXT:M-^LM-^MM-^NM-^OM-^PM-^QM-^RM-^SM-^TM-^UM-^VM-^WM-^XM-^YM-^ZM-^[M-^\M-^]M-^^M-^_68# NP-CAT-OUTPUT-NEXT:M- M-!M-"M-#M-$M-%M-&M-'M-(M-)M-*M-+M-,M--M-.M-/M-0M-1M-2M-369# NP-CAT-OUTPUT-NEXT:M-4M-5M-6M-7M-8M-9M-:M-;M-<M-=M->M-?M-@M-AM-BM-CM-DM-EM-FM-G70# NP-CAT-OUTPUT-NEXT:M-HM-IM-JM-KM-LM-MM-NM-OM-PM-QM-RM-SM-TM-UM-VM-WM-XM-YM-ZM-[71# NP-CAT-OUTPUT-NEXT:M-\M-]M-^M-_M-`M-aM-bM-cM-dM-eM-fM-gM-hM-iM-jM-kM-lM-mM-nM-o72# NP-CAT-OUTPUT-NEXT:M-pM-qM-rM-sM-tM-uM-vM-wM-xM-yM-zM-{M-|M-}M-~M-^?73 74## Test that cat will pipe stdin to stdout if no other files are specified.75# RUN: echo test | cat | FileCheck --check-prefix=CAT-STDIN %s76# CAT-STDIN: test77