199451b44SJordan Rupprechtimport lldb
299451b44SJordan Rupprechtfrom lldbsuite.test.decorators import *
399451b44SJordan Rupprechtfrom lldbsuite.test.lldbtest import *
499451b44SJordan Rupprechtfrom lldbsuite.test import lldbutil
599451b44SJordan Rupprecht
6acb0b99cSRaphael Isemannclass TestCase(TestBase):
799451b44SJordan Rupprecht
899451b44SJordan Rupprecht    @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764")
9acb0b99cSRaphael Isemann    def test(self):
1099451b44SJordan Rupprecht        self.build()
11acb0b99cSRaphael Isemann        lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.cpp"))
1299451b44SJordan Rupprecht
13acb0b99cSRaphael Isemann        # Test that global variables contain the right scope operators.
14acb0b99cSRaphael Isemann        global_vars = self.frame().GetVariables(False, False, True, False)
15*239093f3SJan Kratochvil        # ManualDWARFIndex using NameToDIE does not sort alphabetically.
16*239093f3SJan Kratochvil        global_var_names = sorted([v.GetName() for v in global_vars])
17*239093f3SJan Kratochvil        expected_var_names = ["::a", "A::a", "B::a", "C::a"]
18acb0b99cSRaphael Isemann        self.assertEqual(global_var_names, expected_var_names)
1999451b44SJordan Rupprecht
20acb0b99cSRaphael Isemann        # Test lookup in scopes.
21acb0b99cSRaphael Isemann        self.expect_expr("A::a", result_value="1111")
22acb0b99cSRaphael Isemann        self.expect_expr("B::a", result_value="2222")
23acb0b99cSRaphael Isemann        self.expect_expr("C::a", result_value="3333")
24acb0b99cSRaphael Isemann        self.expect_expr("::a", result_value="4444")
25acb0b99cSRaphael Isemann        # Check that lookup without scope returns the same result.
26acb0b99cSRaphael Isemann        self.expect_expr("a", result_value="4444")
27