| 1 |
## Test cat command with a single file. |
| 2 |
# RUN: rm -rf %t |
| 3 |
# RUN: mkdir -p %t |
| 4 |
# RUN: echo "abcdefgh" > %t/temp.write |
| 5 |
# RUN: cat %t/temp.write > %t/tempcat.write |
| 6 |
# RUN: %{python} %S/../check_path.py file %t/tempcat.write > %t/path.out |
| 7 |
# RUN: FileCheck --check-prefix=FILE-EXISTS < %t/path.out %s |
| 8 |
# RUN: FileCheck --check-prefix=CAT-OUTPUT --implicit-check-not={{.}} \ |
| 9 |
# RUN: --match-full-lines --strict-whitespace < %t/tempcat.write %s |
| 10 |
# FILE-EXISTS: True |
| 11 |
# CAT-OUTPUT:abcdefgh |
| 12 |
|
| 13 |
## Test cat command with multiple files. |
| 14 |
# RUN: rm -rf %t |
| 15 |
# RUN: mkdir -p %t |
| 16 |
# RUN: echo "abcdefgh" > %t/temp1.write |
| 17 |
# RUN: echo "efghijkl" > %t/temp2.write |
| 18 |
# RUN: echo "mnopqrst" > %t/temp3.write |
| 19 |
# RUN: cat %t/temp1.write %t/temp2.write %t/temp3.write > %t/tempmulticat.write |
| 20 |
# RUN: %{python} %S/../check_path.py file %t/tempmulticat.write > %t/path.out |
| 21 |
# RUN: FileCheck --check-prefix=MULTI-FILE-EXISTS < %t/path.out %s |
| 22 |
# RUN: FileCheck --check-prefix=MULTI-CAT-OUTPUT --implicit-check-not={{.}} \ |
| 23 |
# RUN: --match-full-lines --strict-whitespace < %t/tempmulticat.write %s |
| 24 |
# MULTI-FILE-EXISTS: True |
| 25 |
# MULTI-CAT-OUTPUT:abcdefgh |
| 26 |
# MULTI-CAT-OUTPUT-NEXT:efghijkl |
| 27 |
# MULTI-CAT-OUTPUT-NEXT:mnopqrst |
| 28 |
|
| 29 |
## Test cat command with multiple files and piped output to FileCheck. |
| 30 |
# RUN: rm -rf %t |
| 31 |
# RUN: mkdir -p %t |
| 32 |
# RUN: echo "abcdefgh" > %t/temp1.write |
| 33 |
# RUN: echo "efghijkl" > %t/temp2.write |
| 34 |
# 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 %s |
| 37 |
# PIPED-CAT-OUTPUT:abcdefgh |
| 38 |
# PIPED-CAT-OUTPUT-NEXT:efghijkl |
| 39 |
|
| 40 |
## Test cat command with multiple files and glob expressions. |
| 41 |
# RUN: rm -rf %t |
| 42 |
# RUN: mkdir -p %t |
| 43 |
# RUN: echo "cvbnm" > %t/temp1.write |
| 44 |
# RUN: echo "qwerty" > %t/temp2.write |
| 45 |
# RUN: cat %t/*.write | \ |
| 46 |
# RUN: FileCheck --check-prefix=GLOB-CAT-OUTPUT --implicit-check-not={{.}} \ |
| 47 |
# RUN: --match-full-lines --strict-whitespace %s |
| 48 |
# GLOB-CAT-OUTPUT:cvbnm |
| 49 |
# GLOB-CAT-OUTPUT-NEXT:qwerty |
| 50 |
|
| 51 |
## Test cat command with -v and --show-nonprinting option. |
| 52 |
## The -v/--show-nonprinting options format text input into ^ and M- notation |
| 53 |
# 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 %s |
| 56 |
# 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 %s |
| 59 |
# NP-CAT-OUTPUT:^@^A^B^C^D^E^F^G ^H |
| 60 |
# NP-CAT-OUTPUT-NEXT:^K^L^M^N^O^P^Q^R^S |
| 61 |
# NP-CAT-OUTPUT-NEXT:^T^U^V^W^X^Y^Z^[^\^]^^^_ !"#$%&' |
| 62 |
# NP-CAT-OUTPUT-NEXT:()*+,-./0123456789:; |
| 63 |
# NP-CAT-OUTPUT-NEXT:<=>?@ABCDEFGHIJKLMNO |
| 64 |
# NP-CAT-OUTPUT-NEXT:PQRSTUVWXYZ[\]^_`abc |
| 65 |
# NP-CAT-OUTPUT-NEXT:defghijklmnopqrstuvw |
| 66 |
# NP-CAT-OUTPUT-NEXT:xyz{|}~^?M-^@M-^AM-^BM-^CM-^DM-^EM-^FM-^GM-^HM-^IM-^JM-^K |
| 67 |
# 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-3 |
| 69 |
# NP-CAT-OUTPUT-NEXT:M-4M-5M-6M-7M-8M-9M-:M-;M-<M-=M->M-?M-@M-AM-BM-CM-DM-EM-FM-G |
| 70 |
# 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-o |
| 72 |
# 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 %s |
| 76 |
# CAT-STDIN: test |