[Lldb-commits] [lldb] 6952928 - Add a test for top-level expressions using "expr --top-level".
Jim Ingham via lldb-commits
lldb-commits at lists.llvm.org
Tue Jul 27 13:38:24 PDT 2021
Author: Jim Ingham
Date: 2021-07-27T13:38:09-07:00
New Revision: 69529286ce2dcd90563bca97537ce570c6d115b4
URL: https://github.com/llvm/llvm-project/commit/69529286ce2dcd90563bca97537ce570c6d115b4
DIFF: https://github.com/llvm/llvm-project/commit/69529286ce2dcd90563bca97537ce570c6d115b4.diff
LOG: Add a test for top-level expressions using "expr --top-level".
This was broken for a while even though the Python version
continued to work. This adds a test so it doesn't regress.
Added:
Modified:
lldb/test/API/commands/expression/top-level/TestTopLevelExprs.py
Removed:
################################################################################
diff --git a/lldb/test/API/commands/expression/top-level/TestTopLevelExprs.py b/lldb/test/API/commands/expression/top-level/TestTopLevelExprs.py
index 92707eabec0ce..220332759ec4d 100644
--- a/lldb/test/API/commands/expression/top-level/TestTopLevelExprs.py
+++ b/lldb/test/API/commands/expression/top-level/TestTopLevelExprs.py
@@ -92,6 +92,12 @@ def test_top_level_expressions(self):
resultFromCode,
resultFromTopLevel.GetValueAsUnsigned())
+ # Make sure the command line version works as well:
+ self.runCmd("expr --top-level -- int TopLevelFunction() { return 101; }")
+ resultFromTopLevel = self.frame().EvaluateExpression("TopLevelFunction()")
+ self.assertTrue(resultFromTopLevel.IsValid())
+ self.assertEqual(101, resultFromTopLevel.GetValueAsUnsigned(), "Command line version works.")
+
def test_top_level_expression_without_target(self):
self.expect("expr --top-level -- void func() {}", error=True,
substrs=["Top-level code needs to be inserted into a runnable target"])
More information about the lldb-commits
mailing list