[llvm] [llvm-lit][test] Precommit tests for curly braces in lit internal shell (PR #102976)

Paul Kirth via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 15 11:24:56 PDT 2024


================
@@ -0,0 +1,20 @@
+## Test curly braces used in grouping commands.
+
+## Test one command inside curly brace.
+# RUN: { echo bar; } | FileCheck --check-prefix=ONE-CMD %s
+
+# ONE-CMD: bar
+
+## Test two commands inside curly brace.
+# RUN: { echo foo; echo bar; } | FileCheck --check-prefix=TWO-CMDS %s
+
+# TWO-CMDS: foo
+# TWO-CMDS: bar
+
+## Test nested curly brace.
+# RUN: { echo foo; { echo bar; echo baz; }; } | FileCheck --check-prefix=NESTED %s
+# RUN: { { echo foo; echo bar; }; echo baz; } | FileCheck --check-prefix=NESTED %s
----------------
ilovepi wrote:

I'm not sure this is checking things well enough. The nested `{...}` probably needs to result in something that's distinct from the regular case. As written, you cant distinguish the nested version from the un-nested version. Maybe you can use a `|` or file redirection + `cat`?

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


More information about the llvm-commits mailing list