From b84d653e9b49e33f3b109d082cfa527b45c22674 Mon Sep 17 00:00:00 2001 From: Davide Italiano Date: Thu, 15 Mar 2018 00:07:05 +0000 Subject: [PATCH] [Dictionary] Rewrite the test added in r327587 as an inline test. Until we have a better story for putting commands and check lines in the same file (they're currently ignored), it seems that inline tests are actually more concise and easier to understand. Too bad we have still some python boilerplate, but that's not really substantial so we can live with it. Thanks to Fred for pointing out and Jim for explaining me how to use the inline test format. llvm-svn: 327592 --- lldb/lit/DataFormatters/Inputs/NSDict.commands | 3 --- lldb/lit/DataFormatters/Inputs/NSDict.m | 9 --------- lldb/lit/DataFormatters/TestEmptyDictionary.test | 7 ------- lldb/lit/DataFormatters/lit.local.cfg | 1 - .../objc/objc-foundation-dictionary-empty/TestNSDictionary0.py | 6 ++++++ .../test/lang/objc/objc-foundation-dictionary-empty/main.m | 7 +++++++ 6 files changed, 13 insertions(+), 20 deletions(-) delete mode 100644 lldb/lit/DataFormatters/Inputs/NSDict.commands delete mode 100644 lldb/lit/DataFormatters/Inputs/NSDict.m delete mode 100644 lldb/lit/DataFormatters/TestEmptyDictionary.test delete mode 100644 lldb/lit/DataFormatters/lit.local.cfg create mode 100644 lldb/packages/Python/lldbsuite/test/lang/objc/objc-foundation-dictionary-empty/TestNSDictionary0.py create mode 100644 lldb/packages/Python/lldbsuite/test/lang/objc/objc-foundation-dictionary-empty/main.m diff --git a/lldb/lit/DataFormatters/Inputs/NSDict.commands b/lldb/lit/DataFormatters/Inputs/NSDict.commands deleted file mode 100644 index 2f03dae..0000000 --- a/lldb/lit/DataFormatters/Inputs/NSDict.commands +++ /dev/null @@ -1,3 +0,0 @@ -breakpoint set --file NSDict.m --line 8 -run -frame var diff --git a/lldb/lit/DataFormatters/Inputs/NSDict.m b/lldb/lit/DataFormatters/Inputs/NSDict.m deleted file mode 100644 index efc96fd..0000000 --- a/lldb/lit/DataFormatters/Inputs/NSDict.m +++ /dev/null @@ -1,9 +0,0 @@ -#include - -int main(void) -{ - NSDictionary *emptyDictionary = [[NSDictionary alloc] init]; - NSMutableDictionary *mutableDictionary = [NSMutableDictionary dictionary]; - NSDictionary *dictionary = @{ @"key": @{} }; - return 0; -} diff --git a/lldb/lit/DataFormatters/TestEmptyDictionary.test b/lldb/lit/DataFormatters/TestEmptyDictionary.test deleted file mode 100644 index c9e6a0c..0000000 --- a/lldb/lit/DataFormatters/TestEmptyDictionary.test +++ /dev/null @@ -1,7 +0,0 @@ -# Test that foundation NSDictionary0 is formatted correctly (the summary). -# Foundation is only available on Darwin so just restrict the test to run there. -# REQUIRES: darwin -# RUN: %cc %p/Inputs/NSDict.m -framework Foundation -g -o %t && %lldb -b \ -# RUN: -s %p/Inputs/NSDict.commands -- %t 2>&1 | FileCheck %s - -# CHECK: (__NSDictionary0 *) emptyDictionary = {{.*}} 0 key/value pairs diff --git a/lldb/lit/DataFormatters/lit.local.cfg b/lldb/lit/DataFormatters/lit.local.cfg deleted file mode 100644 index df9b335..0000000 --- a/lldb/lit/DataFormatters/lit.local.cfg +++ /dev/null @@ -1 +0,0 @@ -config.suffixes = ['.test'] diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/objc-foundation-dictionary-empty/TestNSDictionary0.py b/lldb/packages/Python/lldbsuite/test/lang/objc/objc-foundation-dictionary-empty/TestNSDictionary0.py new file mode 100644 index 0000000..8049051 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/lang/objc/objc-foundation-dictionary-empty/TestNSDictionary0.py @@ -0,0 +1,6 @@ +from lldbsuite.test import lldbinline +from lldbsuite.test import decorators + +lldbinline.MakeInlineTest( + __file__, globals(), [ + decorators.skipIfFreeBSD, decorators.skipIfLinux, decorators.skipIfWindows]) diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/objc-foundation-dictionary-empty/main.m b/lldb/packages/Python/lldbsuite/test/lang/objc/objc-foundation-dictionary-empty/main.m new file mode 100644 index 0000000..14a792b --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/lang/objc/objc-foundation-dictionary-empty/main.m @@ -0,0 +1,7 @@ +#import + +int main(void) +{ + NSDictionary *emptyDictionary = [[NSDictionary alloc] init]; + return 0; //% self.expect("frame var emptyDictionary", substrs = ["0 key/value pairs"]); +} -- 2.7.4