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 14 @skipIf(macos_version=["<", "10.12"]) 15 @expectedFailureAll(archs=["i[3-6]86"]) 16 def test_read_array(self): 17 self.runToBreakpoint() 18 19 self.expect( 20 "expr --object-description -- immutable_array[0]", 21 VARIABLES_DISPLAYED_CORRECTLY, 22 substrs=["foo"]) 23 24 self.expect( 25 "expr --object-description -- mutable_array[0]", 26 VARIABLES_DISPLAYED_CORRECTLY, 27 substrs=["foo"]) 28 29 @skipIf(macos_version=["<", "10.12"]) 30 @expectedFailureAll(archs=["i[3-6]86"]) 31 def test_update_array(self): 32 self.runToBreakpoint() 33 34 self.expect( 35 "expr --object-description -- mutable_array[0] = @\"bar\"", 36 VARIABLES_DISPLAYED_CORRECTLY, 37 substrs=["bar"]) 38 39 self.expect( 40 "expr --object-description -- mutable_array[0]", 41 VARIABLES_DISPLAYED_CORRECTLY, 42 substrs=["bar"]) 43 44 @skipIf(macos_version=["<", "10.12"]) 45 @expectedFailureAll(archs=["i[3-6]86"]) 46 def test_array_literal(self): 47 self.runToBreakpoint() 48 49 self.expect( 50 "expr --object-description -- @[ @\"foo\", @\"bar\" ]", 51 VARIABLES_DISPLAYED_CORRECTLY, 52 substrs=[ 53 "NSArray", 54 "foo", 55 "bar"]) 56