1"""Test that the Objective-C syntax for dictionary/array literals and indexing works""" 2 3 4import lldb 5from lldbsuite.test.decorators import * 6from lldbsuite.test.lldbtest import * 7from lldbsuite.test import lldbutil 8 9from ObjCNewSyntaxTest import ObjCNewSyntaxTest 10 11 12class ObjCNewSyntaxTestCaseArray(ObjCNewSyntaxTest): 13 @skipIf(macos_version=["<", "10.12"]) 14 @expectedFailureAll(archs=["i[3-6]86"]) 15 def test_read_array(self): 16 self.runToBreakpoint() 17 18 self.expect( 19 "expr --object-description -- immutable_array[0]", 20 VARIABLES_DISPLAYED_CORRECTLY, 21 substrs=["foo"], 22 ) 23 24 self.expect( 25 "expr --object-description -- mutable_array[0]", 26 VARIABLES_DISPLAYED_CORRECTLY, 27 substrs=["foo"], 28 ) 29 30 @skipIf(macos_version=["<", "10.12"]) 31 @expectedFailureAll(archs=["i[3-6]86"]) 32 def test_update_array(self): 33 self.runToBreakpoint() 34 35 self.expect( 36 'expr --object-description -- mutable_array[0] = @"bar"', 37 VARIABLES_DISPLAYED_CORRECTLY, 38 substrs=["bar"], 39 ) 40 41 self.expect( 42 "expr --object-description -- mutable_array[0]", 43 VARIABLES_DISPLAYED_CORRECTLY, 44 substrs=["bar"], 45 ) 46 47 @skipIf(macos_version=["<", "10.12"]) 48 @expectedFailureAll(archs=["i[3-6]86"]) 49 def test_array_literal(self): 50 self.runToBreakpoint() 51 52 self.expect( 53 'expr --object-description -- @[ @"foo", @"bar" ]', 54 VARIABLES_DISPLAYED_CORRECTLY, 55 substrs=["NSArray", "foo", "bar"], 56 ) 57