summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2020-08-03 14:33:06 +0000
committerpatrick <patrick@openbsd.org>2020-08-03 14:33:06 +0000
commit061da546b983eb767bad15e67af1174fb0bcf31c (patch)
tree83c78b820819d70aa40c36d90447978b300078c5 /gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax
parentImport LLVM 10.0.0 release including clang, lld and lldb. (diff)
downloadwireguard-openbsd-061da546b983eb767bad15e67af1174fb0bcf31c.tar.xz
wireguard-openbsd-061da546b983eb767bad15e67af1174fb0bcf31c.zip
Import LLVM 10.0.0 release including clang, lld and lldb.
ok hackroom tested by plenty
Diffstat (limited to 'gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax')
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/Makefile6
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/ObjCNewSyntaxTest.py29
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntaxArray.py58
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntaxDictionary.py57
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntaxLiteral.py78
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/main.m21
6 files changed, 249 insertions, 0 deletions
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/Makefile b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/Makefile
new file mode 100644
index 00000000000..37dd8f40a9d
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/Makefile
@@ -0,0 +1,6 @@
+OBJC_SOURCES := main.m
+
+
+
+LD_EXTRAS := -framework Foundation
+include Makefile.rules
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/ObjCNewSyntaxTest.py b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/ObjCNewSyntaxTest.py
new file mode 100644
index 00000000000..5fa9336b731
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/ObjCNewSyntaxTest.py
@@ -0,0 +1,29 @@
+"""Test that the Objective-C syntax for dictionary/array literals and indexing works"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class ObjCNewSyntaxTest(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def runToBreakpoint(self):
+ self.build()
+ self.target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
+ self, '// Set breakpoint 0 here.', lldb.SBFileSpec(
+ 'main.m', False))
+
+ # The stop reason of the thread should be breakpoint.
+ self.expect(
+ "thread list",
+ STOPPED_DUE_TO_BREAKPOINT,
+ substrs=['stopped', 'stop reason = breakpoint'])
+
+ # The breakpoint should have a hit count of 1.
+ self.expect(
+ "breakpoint list -f",
+ BREAKPOINT_HIT_ONCE,
+ substrs=[' resolved, hit count = 1'])
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntaxArray.py b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntaxArray.py
new file mode 100644
index 00000000000..cf638c7a108
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntaxArray.py
@@ -0,0 +1,58 @@
+"""Test that the Objective-C syntax for dictionary/array literals and indexing works"""
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+from ObjCNewSyntaxTest import ObjCNewSyntaxTest
+
+
+class ObjCNewSyntaxTestCaseArray(ObjCNewSyntaxTest):
+
+ @skipUnlessDarwin
+ @skipIf(macos_version=["<", "10.12"])
+ @expectedFailureAll(archs=["i[3-6]86"])
+ def test_read_array(self):
+ self.runToBreakpoint()
+
+ self.expect(
+ "expr --object-description -- immutable_array[0]",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["foo"])
+
+ self.expect(
+ "expr --object-description -- mutable_array[0]",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["foo"])
+
+ @skipUnlessDarwin
+ @skipIf(macos_version=["<", "10.12"])
+ @expectedFailureAll(archs=["i[3-6]86"])
+ def test_update_array(self):
+ self.runToBreakpoint()
+
+ self.expect(
+ "expr --object-description -- mutable_array[0] = @\"bar\"",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["bar"])
+
+ self.expect(
+ "expr --object-description -- mutable_array[0]",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["bar"])
+
+ @skipUnlessDarwin
+ @skipIf(macos_version=["<", "10.12"])
+ @expectedFailureAll(archs=["i[3-6]86"])
+ def test_array_literal(self):
+ self.runToBreakpoint()
+
+ self.expect(
+ "expr --object-description -- @[ @\"foo\", @\"bar\" ]",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "NSArray",
+ "foo",
+ "bar"])
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntaxDictionary.py b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntaxDictionary.py
new file mode 100644
index 00000000000..5291b46da2f
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntaxDictionary.py
@@ -0,0 +1,57 @@
+"""Test that the Objective-C syntax for dictionary/array literals and indexing works"""
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+from ObjCNewSyntaxTest import ObjCNewSyntaxTest
+
+
+class ObjCNewSyntaxTestCaseDictionary(ObjCNewSyntaxTest):
+
+ @skipUnlessDarwin
+ @skipIf(macos_version=["<", "10.12"])
+ @expectedFailureAll(archs=["i[3-6]86"])
+ def test_read_dictionary(self):
+ self.runToBreakpoint()
+
+ self.expect(
+ "expr --object-description -- immutable_dictionary[@\"key\"]",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["value"])
+
+ self.expect(
+ "expr --object-description -- mutable_dictionary[@\"key\"]",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["value"])
+
+ @skipUnlessDarwin
+ @skipIf(macos_version=["<", "10.12"])
+ @expectedFailureAll(archs=["i[3-6]86"])
+ def test_update_dictionary(self):
+ self.runToBreakpoint()
+
+ self.expect(
+ "expr --object-description -- mutable_dictionary[@\"key\"] = @\"object\"",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["object"])
+
+ self.expect(
+ "expr --object-description -- mutable_dictionary[@\"key\"]",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["object"])
+
+ @skipUnlessDarwin
+ @skipIf(macos_version=["<", "10.12"])
+ @expectedFailureAll(archs=["i[3-6]86"])
+ def test_dictionary_literal(self):
+ self.runToBreakpoint()
+
+ self.expect(
+ "expr --object-description -- @{ @\"key\" : @\"object\" }",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "key",
+ "object"])
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntaxLiteral.py b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntaxLiteral.py
new file mode 100644
index 00000000000..e17343bed72
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntaxLiteral.py
@@ -0,0 +1,78 @@
+"""Test that the Objective-C syntax for dictionary/array literals and indexing works"""
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+from ObjCNewSyntaxTest import ObjCNewSyntaxTest
+
+
+class ObjCNewSyntaxTestCaseLiteral(ObjCNewSyntaxTest):
+
+ @skipUnlessDarwin
+ @skipIf(macos_version=["<", "10.12"])
+ @expectedFailureAll(archs=["i[3-6]86"])
+ def test_char_literal(self):
+ self.runToBreakpoint()
+
+ self.expect("expr --object-description -- @'a'",
+ VARIABLES_DISPLAYED_CORRECTLY, substrs=[str(ord('a'))])
+
+ @skipUnlessDarwin
+ @skipIf(macos_version=["<", "10.12"])
+ @expectedFailureAll(archs=["i[3-6]86"])
+ def test_integer_literals(self):
+ self.runToBreakpoint()
+
+ self.expect(
+ "expr --object-description -- @1",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["1"])
+
+ self.expect(
+ "expr --object-description -- @1l",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["1"])
+
+ self.expect(
+ "expr --object-description -- @1ul",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["1"])
+
+ self.expect(
+ "expr --object-description -- @1ll",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["1"])
+
+ self.expect(
+ "expr --object-description -- @1ull",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["1"])
+
+ @skipUnlessDarwin
+ @skipIf(macos_version=["<", "10.12"])
+ @expectedFailureAll(archs=["i[3-6]86"])
+ def test_float_literal(self):
+ self.runToBreakpoint()
+
+ self.expect("expr -- @123.45", VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["NSNumber", "123.45"])
+
+ @skipUnlessDarwin
+ @skipIf(macos_version=["<", "10.12"])
+ @expectedFailureAll(archs=["i[3-6]86"])
+ def test_expressions_in_literals(self):
+ self.runToBreakpoint()
+
+ self.expect(
+ "expr --object-description -- @( 1 + 3 )",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["4"])
+ self.expect(
+ "expr -- @((char*)\"Hello world\" + 6)",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "NSString",
+ "world"])
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/main.m b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/main.m
new file mode 100644
index 00000000000..d77ba5b10de
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/main.m
@@ -0,0 +1,21 @@
+#import <Foundation/Foundation.h>
+
+int main()
+{
+ @autoreleasepool
+ {
+ // NSArrays
+ NSArray *immutable_array = @[ @"foo", @"bar" ];
+ NSMutableArray *mutable_array = [NSMutableArray arrayWithCapacity:2];
+ [mutable_array addObjectsFromArray:immutable_array];
+
+ // NSDictionaries
+ NSDictionary *immutable_dictionary = @{ @"key" : @"value" };
+ NSMutableDictionary *mutable_dictionary = [NSMutableDictionary dictionaryWithCapacity:1];
+ [mutable_dictionary addEntriesFromDictionary:immutable_dictionary];
+
+ NSNumber *one = @1;
+
+ NSLog(@"Stop here"); // Set breakpoint 0 here.
+ }
+}