2 Test lldb data formatter subsystem.
5 from __future__ import print_function
12 from lldbsuite.test.decorators import *
13 from lldbsuite.test.lldbtest import *
14 from lldbsuite.test import lldbutil
16 class DataFormatterOneIsSingularTestCase(TestBase):
18 mydir = TestBase.compute_mydir(__file__)
21 def test_one_is_singular_with_run_command(self):
22 """Test that 1 item is not as reported as 1 items."""
24 self.oneness_data_formatter_commands()
27 # Call super's setUp().
29 # Find the line number to break at.
30 self.line = line_number('main.m', '// Set break point at this line.')
32 def oneness_data_formatter_commands(self):
33 """Test that 1 item is not as reported as 1 items."""
34 self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
36 lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
38 self.runCmd("run", RUN_SUCCEEDED)
40 # The stop reason of the thread should be breakpoint.
41 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
43 'stop reason = breakpoint'])
45 # This is the function to remove the custom formats in order to have a
46 # clean slate for the next test case.
48 self.runCmd('type format clear', check=False)
49 self.runCmd('type summary clear', check=False)
50 self.runCmd('type synth clear', check=False)
52 # Execute the cleanup function during test case tear down.
53 self.addTearDownHook(cleanup)
55 # Now check that we are displaying Cocoa classes correctly
56 self.expect('frame variable key',
57 substrs = ['@"1 element"'])
58 self.expect('frame variable key', matching=False,
59 substrs = ['1 elements'])
60 self.expect('frame variable value',
61 substrs = ['@"1 element"'])
62 self.expect('frame variable value', matching=False,
63 substrs = ['1 elements'])
64 self.expect('frame variable dict',
65 substrs = ['1 key/value pair'])
66 self.expect('frame variable dict', matching=False,
67 substrs = ['1 key/value pairs'])
68 self.expect('frame variable imset',
69 substrs = ['1 index'])
70 self.expect('frame variable imset', matching=False,
71 substrs = ['1 indexes'])
72 self.expect('frame variable binheap_ref',
73 substrs = ['@"1 item"'])
74 self.expect('frame variable binheap_ref', matching=False,
75 substrs = ['1 items'])
76 self.expect('frame variable immutableData',
78 self.expect('frame variable immutableData', matching=False,
79 substrs = ['1 bytes'])