1# encoding: utf-8 2""" 3Test lldb data formatter subsystem. 4""" 5 6import lldb 7from lldbsuite.test.decorators import * 8from lldbsuite.test.lldbtest import * 9from lldbsuite.test import lldbutil 10 11from ObjCDataFormatterTestCase import ObjCDataFormatterTestCase 12 13 14class ObjCDataFormatterNSNumber(ObjCDataFormatterTestCase): 15 @skipUnlessDarwin 16 def test_nsnumber_with_run_command(self): 17 """Test formatters for NS container classes.""" 18 self.appkit_tester_impl(self.nscontainers_data_formatter_commands, True) 19 20 @skipUnlessDarwin 21 def test_nsnumber_with_run_command_no_const(self): 22 """Test formatters for NS container classes.""" 23 self.appkit_tester_impl(self.nscontainers_data_formatter_commands, False) 24 25 def nscontainers_data_formatter_commands(self): 26 self.runCmd("settings set target.prefer-dynamic-value no-dynamic-values") 27 28 self.expect( 29 "frame variable newArray nsDictionary newDictionary nscfDictionary cfDictionaryRef newMutableDictionary cfarray_ref mutable_array_ref", 30 substrs=[ 31 "(NSArray *) newArray = ", 32 '@"50 elements"', 33 "(NSDictionary *) nsDictionary = ", 34 " 2 key/value pairs", 35 "(NSDictionary *) newDictionary = ", 36 " 12 key/value pairs", 37 "(CFDictionaryRef) cfDictionaryRef = ", 38 " 2 key/value pairs", 39 "(NSDictionary *) newMutableDictionary = ", 40 " 21 key/value pairs", 41 "(CFArrayRef) cfarray_ref = ", 42 '@"3 elements"', 43 "(CFMutableArrayRef) mutable_array_ref = ", 44 '@"11 elements"', 45 ], 46 ) 47 48 numbers = [ 49 ("num1", "(int)5"), 50 ("num2", "(float)3.140000"), 51 ("num3", "(double)3.14"), 52 ("num4", "(int128_t)18446744073709551614"), 53 ("num5", "(char)65"), 54 ("num6", "(long)255"), 55 ("num7", "(long)2000000"), 56 ("num8_Y", "YES"), 57 ("num8_N", "NO"), 58 ("num9", "(short)-31616"), 59 ("num_at1", "(int)12"), 60 ("num_at2", "(int)-12"), 61 ("num_at3", "(double)12.5"), 62 ("num_at4", "(double)-12.5"), 63 ("num_at5", "(char)97"), 64 ("num_at6", "(float)42.123"), 65 ("num_at7", "(double)43.123"), 66 ("num_at8", "(long)12345"), 67 ("num_at9", "17375808098308635870"), 68 ("num_at9b", "-1070935975400915746"), 69 ("num_at10", "YES"), 70 ("num_at11", "NO"), 71 ] 72 73 for var, res in numbers: 74 self.expect("frame variable " + var, substrs=[res]) 75