[Lldb-commits] [lldb] 5ac6106 - [lldb] Re-add NSDate formatter

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 16 23:56:25 PST 2020


Author: Raphael Isemann
Date: 2020-01-17T08:56:05+01:00
New Revision: 5ac610668a7cbde4e8d7106b03ecb218b823fb5c

URL: https://github.com/llvm/llvm-project/commit/5ac610668a7cbde4e8d7106b03ecb218b823fb5c
DIFF: https://github.com/llvm/llvm-project/commit/5ac610668a7cbde4e8d7106b03ecb218b823fb5c.diff

LOG: [lldb] Re-add NSDate formatter

This test had been overwritten by accident in ff75262f701da396a0d34d4f6b67cf8e4c9dc7c2.
This just readds the test with the correct content.

Added: 
    lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py
new file mode 100644
index 000000000000..5cfaa892bb62
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py
@@ -0,0 +1,60 @@
+# encoding: utf-8
+"""
+Test lldb date formatter subsystem.
+"""
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+from ObjCDataFormatterTestCase import ObjCDataFormatterTestCase
+
+import datetime
+
+class ObjCDataFormatterNSDate(ObjCDataFormatterTestCase):
+
+    @skipUnlessDarwin
+    def test_nsdate_with_run_command(self):
+        """Test formatters for  NSDate."""
+        self.appkit_tester_impl(self.nsdate_data_formatter_commands)
+
+    def nsdate_data_formatter_commands(self):
+        self.expect(
+            'frame variable date1 date2',
+            patterns=[
+                '(1985-04-10|1985-04-11)',
+                '(2011-01-01|2010-12-31)'])
+
+        # this test might fail if we hit the breakpoint late on December 31st of some given year
+        # and midnight comes between hitting the breakpoint and running this line of code
+        # hopefully the output will be revealing enough in that case :-)
+        now_year = '%s-' % str(datetime.datetime.now().year)
+
+        self.expect('frame variable date3', substrs=[now_year])
+        self.expect('frame variable date4', substrs=['1970'])
+        self.expect('frame variable date5', substrs=[now_year])
+
+        self.expect('frame variable date1_abs date2_abs',
+                    substrs=['1985-04', '2011-01'])
+
+        self.expect('frame variable date3_abs', substrs=[now_year])
+        self.expect('frame variable date4_abs', substrs=['1970'])
+        self.expect('frame variable date5_abs', substrs=[now_year])
+
+        self.expect('frame variable cupertino home europe',
+                    substrs=['@"America/Los_Angeles"',
+                             '@"Europe/Rome"',
+                             '@"Europe/Paris"'])
+
+        self.expect('frame variable cupertino_ns home_ns europe_ns',
+                    substrs=['@"America/Los_Angeles"',
+                             '@"Europe/Rome"',
+                             '@"Europe/Paris"'])
+
+        self.expect(
+            'frame variable mut_bv',
+            substrs=[
+                '(CFMutableBitVectorRef) mut_bv = ',
+                '1110 0110 1011 0000 1101 1010 1000 1111 0011 0101 1101 0001 00'])


        


More information about the lldb-commits mailing list