3 Test lldb data formatter subsystem.
9 from lldbsuite.test.decorators import *
10 from lldbsuite.test.lldbtest import *
11 from lldbsuite.test import lldbutil
14 class StdStringDataFormatterTestCase(TestBase):
16 mydir = TestBase.compute_mydir(__file__)
19 # Call super's setUp().
21 # Find the line number to break at.
22 self.line = line_number('main.cpp', '// Set break point at this line.')
24 @add_test_categories(["libstdcxx"])
25 def test_with_run_command(self):
26 """Test that that file and class static variables display correctly."""
28 self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
30 lldbutil.run_break_set_by_file_and_line(
31 self, "main.cpp", self.line, num_expected_locations=-1)
33 self.runCmd("run", RUN_SUCCEEDED)
35 # The stop reason of the thread should be breakpoint.
36 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
38 'stop reason = breakpoint'])
40 # This is the function to remove the custom formats in order to have a
41 # clean slate for the next test case.
43 self.runCmd('type format clear', check=False)
44 self.runCmd('type summary clear', check=False)
45 self.runCmd('type filter clear', check=False)
46 self.runCmd('type synth clear', check=False)
48 "settings set target.max-children-count 256",
51 # Execute the cleanup function during test case tear down.
52 self.addTearDownHook(cleanup)
54 var_wempty = self.frame().FindVariable('wempty')
55 var_s = self.frame().FindVariable('s')
56 var_S = self.frame().FindVariable('S')
57 var_mazeltov = self.frame().FindVariable('mazeltov')
58 var_empty = self.frame().FindVariable('empty')
59 var_q = self.frame().FindVariable('q')
60 var_Q = self.frame().FindVariable('Q')
61 var_uchar = self.frame().FindVariable('uchar')
63 # TODO: This is currently broken
64 # self.assertEqual(var_wempty.GetSummary(), 'L""', "wempty summary wrong")
66 var_s.GetSummary(), 'L"hello world! מזל טוב!"',
68 self.assertEqual(var_S.GetSummary(), 'L"!!!!"', "S summary wrong")
70 var_mazeltov.GetSummary(), 'L"מזל טוב"',
71 "mazeltov summary wrong")
72 self.assertEqual(var_empty.GetSummary(), '""', "empty summary wrong")
74 var_q.GetSummary(), '"hello world"',
77 var_Q.GetSummary(), '"quite a long std::strin with lots of info inside it"',
79 self.assertEqual(var_uchar.GetSummary(), '"aaaaa"', "u summary wrong")
84 var_S.GetSummary(), 'L"!!!!!"',
85 "new S summary wrong")