From ba96f1a73ec1b4a306b9b2daef6094898f6ad30d Mon Sep 17 00:00:00 2001 From: Michal Domonkos Date: Tue, 12 Nov 2024 12:37:02 +0100 Subject: [PATCH] Add note about square brackets to tests README This is part of M4, not specific to our test-suite, but it's a question that comes up often, and everyone (myself included) tends to forget how it's done. --- tests/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/README.md b/tests/README.md index ab2a6535da..acdeffed04 100644 --- a/tests/README.md +++ b/tests/README.md @@ -155,3 +155,13 @@ as well as the existing tests. Below are the specifics of RPM's test-suite: `runroot_user -n ` to run a binary as a specific user * If no snapshot was used, just call the RPM binaries normally * Store any working files in the current directory (it's always writable) + +### Tips & Tricks + +* Sometimes, you may need to specify a literal square bracket, such as in RPM + commands using `--qf` format strings. Do that by wrapping the whole script + (or expected output) in double square brackets, for example: + + RPMTEST_CHECK([[ + runroot rpm -q --qf '[%{FILENAMES}\n]' ... + ]])