[llvm] [llvm-lit][test] Updated built-in cat command tests (PR #104473)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 16 00:06:51 PDT 2024


================
@@ -1,83 +1,77 @@
 ## Test cat command with a single file.
 #
-# RUN: rm -rf %T/testCat
-# RUN: mkdir -p %T/testCat
-# RUN: echo "abcdefgh" > %T/testCat/temp.write
-# RUN: cat %T/testCat/temp.write > %T/testCat/tempcat.write
-# RUN: %{python} %S/../check_path.py file %T/testCat/tempcat.write > %T/testCat/path.out
-# RUN: FileCheck --check-prefix=FILE-EXISTS < %T/testCat/path.out %s
-# RUN: FileCheck --check-prefix=CAT-OUTPUT < %T/testCat/tempcat.write %s
+# RUN: rm -rf %t
+# RUN: mkdir -p %t
+# RUN: echo "abcdefgh" > %t/temp.write
+# RUN: cat %t/temp.write > %t/tempcat.write
+# RUN: %{python} %S/../check_path.py file %t/tempcat.write > %t/path.out
+# RUN: FileCheck --check-prefix=FILE-EXISTS < %t/path.out %s
+# RUN: FileCheck --check-prefix=CAT-OUTPUT --implicit-check-not={{.}} \
+# RUN:      --match-full-lines --strict-whitespace < %t/tempcat.write %s
 # FILE-EXISTS: True
-# CAT-OUTPUT: abcdefgh
+# CAT-OUTPUT:abcdefgh
 #
 ## Test cat command with multiple files.
 #
-# RUN: rm -rf %T/testCat
-# RUN: mkdir -p %T/testCat
-# RUN: echo "abcdefgh" > %T/testCat/temp1.write
-# RUN: echo "efghijkl" > %T/testCat/temp2.write
-# RUN: echo "mnopqrst" > %T/testCat/temp3.write
-# RUN: cat %T/testCat/temp1.write %T/testCat/temp2.write %T/testCat/temp3.write > %T/testCat/tempmulticat.write
-# RUN: %{python} %S/../check_path.py file %T/testCat/tempmulticat.write > %T/testCat/path.out
-# RUN: FileCheck --check-prefix=MULTI-FILE-EXISTS < %T/testCat/path.out %s
-# RUN: FileCheck --check-prefix=MULTI-CAT-OUTPUT < %T/testCat/tempmulticat.write %s
+# RUN: rm -rf %t
+# RUN: mkdir -p %t
+# RUN: echo "abcdefgh" > %t/temp1.write
+# RUN: echo "efghijkl" > %t/temp2.write
+# RUN: echo "mnopqrst" > %t/temp3.write
+# RUN: cat %t/temp1.write %t/temp2.write %t/temp3.write > %t/tempmulticat.write
+# RUN: %{python} %S/../check_path.py file %t/tempmulticat.write > %t/path.out
+# RUN: FileCheck --check-prefix=MULTI-FILE-EXISTS < %t/path.out %s
+# RUN: FileCheck --check-prefix=MULTI-CAT-OUTPUT --implicit-check-not={{.}} \
+# RUN:      --match-full-lines --strict-whitespace < %t/tempmulticat.write %s
 # MULTI-FILE-EXISTS: True
-# MULTI-CAT-OUTPUT: abcdefgh
-# MULTI-CAT-OUTPUT-NEXT: efghijkl
-# MULTI-CAT-OUTPUT-NEXT: mnopqrst
+#      MULTI-CAT-OUTPUT:abcdefgh
+# MULTI-CAT-OUTPUT-NEXT:efghijkl
+# MULTI-CAT-OUTPUT-NEXT:mnopqrst
 #
 ## Test cat command with multiple files and piped output to FileCheck.
 #
-# RUN: rm -rf %T/testCat
-# RUN: mkdir -p %T/testCat
-# RUN: echo "abcdefgh" > %T/testCat/temp1.write
-# RUN: echo "efghijkl" > %T/testCat/temp2.write
-# RUN: cat %T/testCat/temp1.write %T/testCat/temp2.write | FileCheck --check-prefix=PIPED-CAT-OUTPUT %s
-# PIPED-CAT-OUTPUT: abcdefgh
-# PIPED-CAT-OUTPUT-NEXT: efghijkl
+# RUN: rm -rf %t
+# RUN: mkdir -p %t
+# RUN: echo "abcdefgh" > %t/temp1.write
+# RUN: echo "efghijkl" > %t/temp2.write
+# RUN: cat %t/temp1.write %t/temp2.write \
----------------
jh7370 wrote:

My personal preference is to have the `\` and `|` on the same line (i.e. `| \`), with the next line indented. In this way, you can see from the first line that you've got to the end of the options for that command, and then the indentation on the next line shows that it's a continuation of the previous line.

https://github.com/llvm/llvm-project/pull/104473


More information about the llvm-commits mailing list