File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,50 @@ final class DocumentPlaygroundDiscoveryTests: XCTestCase {
8181 )
8282 }
8383
84+ func testNoImportPlaygroundsTests( ) async throws {
85+ let project = try await SwiftPMTestProject (
86+ files: [
87+ " Sources/MyLibrary/MyLib.swift " : """
88+ public func foo() -> String {
89+ " bar "
90+ }
91+
92+ #Playground( " foo " ) {
93+ print(foo())
94+ }
95+
96+ #Playground {
97+ print(foo())
98+ }
99+
100+ public func bar(_ i: Int, _ j: Int) -> Int {
101+ i + j
102+ }
103+
104+ #Playground( " bar " ) {
105+ var i = bar(1, 2)
106+ i = i + 1
107+ print(i)
108+ }
109+ """
110+ ] ,
111+ manifest: """
112+ import PackageDescription
113+ let package = Package(
114+ name: " MyLibrary " ,
115+ targets: [.target(name: " MyLibrary " )]
116+ )
117+ """ ,
118+ enableBackgroundIndexing: false
119+ )
120+
121+ let ( uri, _) = try project. openDocument ( " MyLib.swift " )
122+ let playgrounds = try await project. testClient. send (
123+ DocumentPlaygroundsRequest ( textDocument: TextDocumentIdentifier ( uri) )
124+ )
125+ XCTAssertEqual ( playgrounds, [ ] )
126+ }
127+
84128 func testParseNoPlaygroundsTests( ) async throws {
85129 let project = try await SwiftPMTestProject (
86130 files: [
You can’t perform that action at this time.
0 commit comments