Fix ObjCDataFormatterTestCase.test_nsdate_* tests
authorIlia K <ki.stfu@gmail.com>
Mon, 23 Mar 2015 12:44:54 +0000 (12:44 +0000)
committerIlia K <ki.stfu@gmail.com>
Mon, 23 Mar 2015 12:44:54 +0000 (12:44 +0000)
The time/date strings (like "6pm April 10, 1985") are interpreted as a local time but CFDateGetAbsoluteTime() returns time in UTC. It caused a problem when local time was UTC+0100 or more (0200, 0300 etc.):
```
======================================================================
FAIL: test_nsdate_with_dsym_and_run_command (TestDataFormatterObjC.ObjCDataFormatterTestCase)
    Test formatters for NSDate.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/IliaK/p/llvm/tools/lldb/test/lldbtest.py", line 462, in wrapper
    return func(self, *args, **kwargs)
  File "/Users/IliaK/p/llvm/tools/lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py", line 157, in test_nsdate_with_dsym_and_run_command
    self.appkit_tester_impl(self.buildDsym,self.nsdate_data_formatter_commands)
  File "/Users/IliaK/p/llvm/tools/lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py", line 34, in appkit_tester_impl
    commands()
  File "/Users/IliaK/p/llvm/tools/lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py", line 475, in nsdate_data_formatter_commands
    substrs = ['1985-04','2011-01'])
  File "/Users/IliaK/p/llvm/tools/lldb/test/lldbtest.py", line 2146, in expect
    msg if msg else EXP_MSG(str, exe))
AssertionError: False is not True : '2011-01' returns expected result
Config=x86_64-clang
======================================================================
FAIL: test_nsdate_with_dwarf_and_run_command (TestDataFormatterObjC.ObjCDataFormatterTestCase)
    Test formatters for NSDate.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/IliaK/p/llvm/tools/lldb/test/lldbtest.py", line 479, in wrapper
    return func(self, *args, **kwargs)
  File "/Users/IliaK/p/llvm/tools/lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py", line 163, in test_nsdate_with_dwarf_and_run_command
    self.appkit_tester_impl(self.buildDwarf,self.nsdate_data_formatter_commands)
  File "/Users/IliaK/p/llvm/tools/lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py", line 34, in appkit_tester_impl
    commands()
  File "/Users/IliaK/p/llvm/tools/lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py", line 475, in nsdate_data_formatter_commands
    substrs = ['1985-04','2011-01'])
  File "/Users/IliaK/p/llvm/tools/lldb/test/lldbtest.py", line 2146, in expect
    msg if msg else EXP_MSG(str, exe))
AssertionError: False is not True : '2011-01' returns expected result
Config=x86_64-clang
```

llvm-svn: 232946

lldb/test/functionalities/data-formatter/data-formatter-objc/main.m

index 6eb7e02..42725be 100644 (file)
@@ -546,8 +546,8 @@ int main (int argc, const char * argv[])
            NSURL *nsurl2 = [NSURL URLWithString:@"page.html" relativeToURL:nsurl];
            NSURL *nsurl3 = [NSURL URLWithString:@"?whatever" relativeToURL:nsurl2];
     
-               NSDate *date1 = [NSDate dateWithNaturalLanguageString:@"6pm April 10, 1985"];
-               NSDate *date2 = [NSDate dateWithNaturalLanguageString:@"12am January 1, 2011"];
+               NSDate *date1 = [NSDate dateWithNaturalLanguageString:@"6pm April 10, 1985 UTC"];
+               NSDate *date2 = [NSDate dateWithNaturalLanguageString:@"12am January 1, 2011 UTC"];
                NSDate *date3 = [NSDate date];
                NSDate *date4 = [NSDate dateWithTimeIntervalSince1970:24*60*60];