xref: /llvm-project/lldb/test/API/lang/objc/orderedset/TestOrderedSet.py (revision 34d78b6a6755946e547afc47d38b59b6a2854457)
1import lldb
2from lldbsuite.test.decorators import *
3from lldbsuite.test.lldbtest import *
4from lldbsuite.test import lldbutil
5
6class TestOrderedSet(TestBase):
7  mydir = TestBase.compute_mydir(__file__)
8
9  def test_ordered_set(self):
10    self.build()
11    self.run_tests()
12
13  @skipUnlessDarwin
14  def test_ordered_set_no_const(self):
15    disable_constant_classes = {
16        'CC':
17        'xcrun clang',  # FIXME: Remove when flags are available upstream.
18        'CFLAGS_EXTRAS':
19        '-fno-constant-nsnumber-literals ' +
20        '-fno-constant-nsarray-literals ' +
21        '-fno-constant-nsdictionary-literals'
22    }
23    self.build(dictionary=disable_constant_classes)
24    self.run_tests()
25
26  def run_tests(self):
27    src_file = "main.m"
28    src_file_spec = lldb.SBFileSpec(src_file)
29    (target, process, thread, main_breakpoint) = lldbutil.run_to_source_breakpoint(self,
30          "break here", src_file_spec, exe_name = "a.out")
31    frame = thread.GetSelectedFrame()
32    self.expect("expr -d run -- orderedSet", substrs=["3 elements"])
33    self.expect("expr -d run -- *orderedSet", substrs=["(int)1", "(int)2", "(int)3"])
34