brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · da86466 Raw
36 lines · python
1"""2Test basic std::shared_ptr functionality.3"""4 5from lldbsuite.test.decorators import *6from lldbsuite.test.lldbtest import *7from lldbsuite.test import lldbutil8 9 10class TestSharedPtr(TestBase):11    @add_test_categories(["libc++"])12    @skipIf(compiler=no_match("clang"))13    @skipIf(macos_version=["<", "15.0"])14    @skipIf(compiler="clang", compiler_version=["<", "17.0"])15    def test(self):16        self.build()17 18        lldbutil.run_to_source_breakpoint(19            self, "// Set break point at this line.", lldb.SBFileSpec("main.cpp")20        )21 22        self.runCmd("settings set target.import-std-module true")23 24        self.expect_expr(25            "s",26            result_type="std::shared_ptr<int>",27            result_summary="3 strong=1 weak=0",28            result_children=[ValueCheck(name="pointer")],29        )30        self.expect_expr("*s", result_type="element_type", result_value="3")31        self.expect_expr("*s = 5", result_type="element_type", result_value="5")32        self.expect_expr("*s", result_type="element_type", result_value="5")33        self.expect_expr("(bool)s", result_type="bool", result_value="true")34        self.expect("expr s.reset()")35        self.expect_expr("(bool)s", result_type="bool", result_value="false")36