Files
sourcekit-lsp/Tests/SourceKitLSPTests/ReferencesTests.swift
Alex Hoppen 93092ffefe Enable testReferencesInMacro
I’m no longer seeing the issue that caused me to disable the test. Let’s re-enable it.

Fixes #1758
rdar://137922381
2024-10-24 15:51:45 -07:00

48 lines
1.5 KiB
Swift
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
import LanguageServerProtocol
import SKTestSupport
import XCTest
/// Tests that test the overall state of the SourceKit-LSP server, that's not really specific to any language
final class ReferencesTests: XCTestCase {
func testReferencesInMacro() async throws {
let project = try await IndexedSingleSwiftFileTestProject(
"""
import Observation
@available(macOS 14.0, *)
1⃣@Observable
class 2⃣Foo {
var x: Int = 2
}
"""
)
let response = try await project.testClient.send(
ReferencesRequest(
textDocument: TextDocumentIdentifier(project.fileURI),
position: project.positions["2"],
context: ReferencesContext(includeDeclaration: true)
)
)
XCTAssertEqual(
response,
[
Location(uri: project.fileURI, range: Range(project.positions["1"])),
Location(uri: project.fileURI, range: Range(project.positions["2"])),
]
)
}
}