[clang-tools-extra] [clang-doc] Refactor error handling to use ExitOnError (PR #141699)

Paul Kirth via cfe-commits cfe-commits at lists.llvm.org
Thu May 29 09:27:40 PDT 2025


================
@@ -0,0 +1,12 @@
+// Test: Invalid output path (%t is a file, not a directory)
+// RUN: rm -rf %t && echo "not a dir" > %t
+// RUN: not clang-doc %s -output=%t/subdir 2>&1 | FileCheck --check-prefix=BAD-OUTPUT %s
+
+// BAD-OUTPUT: clang-doc error:
+// BAD-OUTPUT: {{(Not a directory|no such file or directory)}}
+
+//
+// Test: Invalid format option
+// RUN: not clang-doc %s -format=badformat 2>&1 | FileCheck --check-prefix=BAD-FORMAT %s
----------------
ilovepi wrote:

```suggestion
// RUN: not clang-doc %s -format=badformat 2>&1 | FileCheck %s --check-prefix=BAD-FORMAT
```
nit: this is just the common pattern in tests. What you wrote isn't wrong, but its jarring after reading so many tests w/ the common pattern.

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


More information about the cfe-commits mailing list