Files
clang-p2996/lldb/test/API/python_api/sblaunchinfo/TestSBLaunchInfo.py
Dave Lee 4cc8f2a017 [lldb][tests] Automatically call compute_mydir (NFC)
Eliminate boilerplate of having each test manually assign to `mydir` by calling
`compute_mydir` in lldbtest.py.

Differential Revision: https://reviews.llvm.org/D128077
2022-06-17 14:34:49 -07:00

29 lines
795 B
Python

"""
Test SBLaunchInfo
"""
from lldbsuite.test.lldbtest import *
def lookup(info, key):
for i in range(info.GetNumEnvironmentEntries()):
KeyEqValue = info.GetEnvironmentEntryAtIndex(i)
Key, Value = KeyEqValue.split("=")
if Key == key:
return Value
return ""
class TestSBLaunchInfo(TestBase):
NO_DEBUG_INFO_TESTCASE = True
def test_environment_getset(self):
info = lldb.SBLaunchInfo(None)
info.SetEnvironmentEntries(["FOO=BAR"], False)
self.assertEquals(1, info.GetNumEnvironmentEntries())
info.SetEnvironmentEntries(["BAR=BAZ"], True)
self.assertEquals(2, info.GetNumEnvironmentEntries())
self.assertEquals("BAR", lookup(info, "FOO"))
self.assertEquals("BAZ", lookup(info, "BAR"))