Skip to content

Commit 284c281

Browse files
committed
[lldb][test] Add regression test for Swift.ArraySlice (NFC) (#5519)
Add regression tests for printing `ArraySlice` values. rdar://92898538 (cherry picked from commit 0c3768e)
1 parent a7014f4 commit 284c281

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SWIFT_SOURCES := main.swift
2+
3+
include Makefile.rules
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"""
2+
Test ArraySlice synthetic types.
3+
"""
4+
import lldb
5+
from lldbsuite.test.lldbtest import *
6+
from lldbsuite.test.decorators import *
7+
import lldbsuite.test.lldbutil as lldbutil
8+
9+
10+
class TestCase(TestBase):
11+
@swiftTest
12+
def test_swift_array_slice_formatters(self):
13+
"""Test ArraySlice synthetic types."""
14+
self.build()
15+
lldbutil.run_to_source_breakpoint(
16+
self, "break here", lldb.SBFileSpec("main.swift")
17+
)
18+
19+
# TODO: Fix `arraySubSequence` rdar://92898538
20+
for var in ("someSlice", "arraySlice"):
21+
self.expect(f"v {var}", substrs=[f"{var} = 2 values", "[1] = 2", "[2] = 3"])
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
func main() {
2+
let a = [1, 2, 3]
3+
let someSlice = a[1...]
4+
let arraySlice: ArraySlice<Int> = a[1...]
5+
let arraySubSequence: Array<Int>.SubSequence = a[1...]
6+
// break here
7+
}
8+
9+
main()

0 commit comments

Comments
 (0)