[Lldb-commits] [PATCH] D101153: [lldb][NFC] Specify guidelines for API tests

Jordan Rupprecht via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Apr 23 10:16:21 PDT 2021


rupprecht added a comment.

LGTM too, thanks for writing this up!



================
Comment at: lldb/docs/resources/test.rst:264
+::
+    self.expect("expr 1 - 1", substrs=["0"])
+
----------------
shafik wrote:
> Maybe some more examples with alternatives would be helpful here.
Also mentioning why this check is bad would help spell it out. IIUC, it's because the full output will include `$0` (if it's the first expression, as noted); in which case, a stronger example is something that's clearly wrong:

```
(lldb) expr 5-3
(int) $0 = 2
```

In which case, `self.expect("expr 5 - 3", substrs=["0"])` passes, but shouldn't.


================
Comment at: lldb/docs/resources/test.rst:279-280
+    self.assertTrue(expected_string in list_of_results)
+    # Good. Will print expected_string and the contents of list_of_results.
+    self.assertIn(expected_string, list_of_results) # Good.
+
----------------
nit: extra "# Good"


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101153/new/

https://reviews.llvm.org/D101153



More information about the lldb-commits mailing list