89 lines · python
1"""Test that the Objective-C syntax for dictionary/array literals and indexing works"""2 3 4import lldb5from lldbsuite.test.decorators import *6from lldbsuite.test.lldbtest import *7from lldbsuite.test import lldbutil8 9from ObjCNewSyntaxTest import ObjCNewSyntaxTest10 11 12class ObjCNewSyntaxTestCaseLiteral(ObjCNewSyntaxTest):13 @skipIf(macos_version=["<", "10.12"])14 @expectedFailureAll(archs=["i[3-6]86"])15 def test_char_literal(self):16 self.runToBreakpoint()17 18 self.expect(19 "expr --object-description -- @'a'",20 VARIABLES_DISPLAYED_CORRECTLY,21 substrs=[str(ord("a"))],22 )23 24 @skipIf(macos_version=["<", "10.12"])25 @expectedFailureAll(archs=["i[3-6]86"])26 def test_integer_literals(self):27 self.runToBreakpoint()28 29 self.expect(30 "expr --object-description -- @1",31 VARIABLES_DISPLAYED_CORRECTLY,32 substrs=["1"],33 )34 35 self.expect(36 "expr --object-description -- @1l",37 VARIABLES_DISPLAYED_CORRECTLY,38 substrs=["1"],39 )40 41 self.expect(42 "expr --object-description -- @1ul",43 VARIABLES_DISPLAYED_CORRECTLY,44 substrs=["1"],45 )46 47 self.expect(48 "expr --object-description -- @1ll",49 VARIABLES_DISPLAYED_CORRECTLY,50 substrs=["1"],51 )52 53 self.expect(54 "expr --object-description -- @1ull",55 VARIABLES_DISPLAYED_CORRECTLY,56 substrs=["1"],57 )58 59 @skipIf(macos_version=["<", "10.12"])60 @expectedFailureAll(archs=["i[3-6]86"])61 def test_float_literal(self):62 self.runToBreakpoint()63 64 self.runCmd("settings set target.prefer-dynamic-value no-dynamic-values")65 66 self.expect(67 "expr -- @123.45",68 VARIABLES_DISPLAYED_CORRECTLY,69 substrs=["NSNumber", "123.45"],70 )71 72 @skipIf(macos_version=["<", "10.12"])73 @expectedFailureAll(archs=["i[3-6]86"])74 def test_expressions_in_literals(self):75 self.runToBreakpoint()76 77 self.runCmd("settings set target.prefer-dynamic-value no-dynamic-values")78 79 self.expect(80 "expr --object-description -- @( 1 + 3 )",81 VARIABLES_DISPLAYED_CORRECTLY,82 substrs=["4"],83 )84 self.expect(85 'expr -- @((char*)"Hello world" + 6)',86 VARIABLES_DISPLAYED_CORRECTLY,87 substrs=["NSString", "world"],88 )89