[AMDGPU] Add True16 register classes.
[llvm-project.git] / lldb / test / API / commands / expression / persistent_result / TestPersistentResult.py
blob911b8f605939b9c14341812bb729e722c1e260c2
1 """
2 Test controlling `expression` result variables are persistent.
3 """
5 import lldb
6 from lldbsuite.test.lldbtest import *
7 from lldbsuite.test.decorators import *
8 from lldbsuite.test import lldbutil
11 class TestCase(TestBase):
12 def setUp(self):
13 TestBase.setUp(self)
14 self.build()
15 lldbutil.run_to_source_breakpoint(self, "break here", lldb.SBFileSpec("main.c"))
17 def test_enable_persistent_result(self):
18 """Test explicitly enabling result variables persistence."""
19 self.expect("expression --persistent-result on -- i", substrs=["(int) $0 = 30"])
20 # Verify the lifetime of $0 extends beyond the `expression` it was created in.
21 self.expect("expression $0", substrs=["(int) $0 = 30"])
23 def test_disable_persistent_result(self):
24 """Test explicitly disabling persistent result variables."""
25 self.expect("expression --persistent-result off -- i", substrs=["(int) 30"])
26 # Verify a persistent result was not silently created.
27 self.expect("expression $0", error=True)
29 def test_expression_persists_result(self):
30 """Test `expression`'s default behavior is to persist a result variable."""
31 self.expect("expression i", substrs=["(int) $0 = 30"])
32 self.expect("expression $0", substrs=["(int) $0 = 30"])
34 def test_p_does_not_persist_results(self):
35 """Test `p` does not persist a result variable."""
36 self.expect("p i", startstr="(int) 30")
37 self.expect("p $0", error=True)