|
9 | 9 | # See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors |
10 | 10 | # |
11 | 11 | # ------------------------------------------------------------------------------ |
12 | | -import lldbsuite.test.lldbinline as lldbinline |
| 12 | +from lldbsuite.test.lldbtest import * |
13 | 13 | from lldbsuite.test.decorators import * |
| 14 | +import lldbsuite.test.lldbutil as lldbutil |
14 | 15 |
|
15 | | -lldbinline.MakeInlineTest(__file__, globals(), |
16 | | - decorators=[swiftTest]) |
| 16 | + |
| 17 | +class TestClosureShortcuts(TestBase): |
| 18 | + @swiftTest |
| 19 | + def test(self): |
| 20 | + self.build() |
| 21 | + target, process, thread, bkpt = lldbutil.run_to_source_breakpoint( |
| 22 | + self, "break here for anonymous variable", lldb.SBFileSpec("main.swift") |
| 23 | + ) |
| 24 | + # |
| 25 | + # rdar://159316245 |
| 26 | + self.runCmd("settings set target.experimental.use-DIL false") |
| 27 | + self.expect("expr $0", substrs=["patatino"]) |
| 28 | + self.expect("expr $1", substrs=["foo"]) |
| 29 | + self.expect("frame var $0", substrs=["patatino"]) |
| 30 | + self.expect("frame var $1", substrs=["foo"]) |
| 31 | + |
| 32 | + lldbutil.continue_to_source_breakpoint( |
| 33 | + self, process, "break here for tinky", lldb.SBFileSpec("main.swift") |
| 34 | + ) |
| 35 | + self.expect("expr [12, 14].map({$0 + 2})", substrs=["[0] = 14", "[1] = 16"]) |
| 36 | + |
| 37 | + lldbutil.continue_to_source_breakpoint( |
| 38 | + self, process, "break here for outer scope", lldb.SBFileSpec("main.swift") |
| 39 | + ) |
| 40 | + self.expect("expr tinky.map({$0 * 2})", substrs=["[0] = 4", "[1] = 8"]) |
| 41 | + self.expect("expr [2,4].map({$0 * 2})", substrs=["[0] = 4", "[1] = 8"]) |
| 42 | + self.expect("expr $0", substrs=["cannot find '$0' in scope"], error=True) |
0 commit comments