mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-04 00:06:50 +00:00
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.
This commit is contained in:
parent
910353c104
commit
69529286ce
@ -92,6 +92,12 @@ class TopLevelExpressionsTestCase(TestBase):
|
||||
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"])
|
||||
|
Loading…
x
Reference in New Issue
Block a user