1import lldb
2from lldbsuite.test.decorators import *
3from lldbsuite.test.lldbtest import *
4from lldbsuite.test import lldbutil
5
6class TestCase(TestBase):
7
8    mydir = TestBase.compute_mydir(__file__)
9
10    @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764")
11    def test(self):
12        self.build()
13        lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.cpp"))
14
15        # Test that global variables contain the right scope operators.
16        global_vars = self.frame().GetVariables(False, False, True, False)
17        global_var_names = [v.GetName() for v in global_vars]
18        expected_var_names = ["A::a", "B::a", "C::a", "::a"]
19        self.assertEqual(global_var_names, expected_var_names)
20
21        # Test lookup in scopes.
22        self.expect_expr("A::a", result_value="1111")
23        self.expect_expr("B::a", result_value="2222")
24        self.expect_expr("C::a", result_value="3333")
25        self.expect_expr("::a", result_value="4444")
26        # Check that lookup without scope returns the same result.
27        self.expect_expr("a", result_value="4444")
28