1# encoding: utf-8 2""" 3Test lldb data formatter subsystem. 4""" 5 6 7import lldb 8from lldbsuite.test.decorators import * 9from lldbsuite.test.lldbtest import * 10from lldbsuite.test import lldbutil 11 12from ObjCDataFormatterTestCase import ObjCDataFormatterTestCase 13 14 15class ObjCDataFormatterNSError(ObjCDataFormatterTestCase): 16 def test_nserror_with_run_command(self): 17 """Test formatters for NSError.""" 18 self.appkit_tester_impl(self.nserror_data_formatter_commands, True) 19 20 @skipUnlessDarwin 21 def test_nserror_with_run_command_no_const(self): 22 """Test formatters for NSError.""" 23 self.appkit_tester_impl(self.nserror_data_formatter_commands, False) 24 25 def nserror_data_formatter_commands(self): 26 self.expect( 27 "frame variable nserror", substrs=['domain: @"Foobar" - code: -1234'] 28 ) 29 30 self.expect( 31 "frame variable nserrorptr", substrs=['domain: @"Foobar" - code: -1234'] 32 ) 33 34 self.expect("frame variable nserror->_userInfo", substrs=["2 key/value pairs"]) 35 36 self.expect( 37 "frame variable nserror->_userInfo --ptr-depth 1 -d run-target", 38 substrs=['@"a"', "1", '@"b"', "2"], 39 ) 40