Skip to content

Commit 3dc6dd0

Browse files
authored
Fix test that became flaky after recent snippets change (#1308)
Depending on which symbol was _first_ in the dictionary of symbols, the entire symbol graph was categorized as either a snippet symbol graph or a regular symbol graph. However, real symbol graph files don't mix snippets and framework symbols like that. This fixes the test to don't mix snippets with real symbols. It also stops adding module nodes inside the symbol graph, because that also doesn't match real symbol graph files.
1 parent 527558e commit 3dc6dd0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Tests/SwiftDocCTests/Infrastructure/DocumentationContext/DocumentationContextTests.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4935,7 +4935,11 @@ let expected = """
49354935
func testContextDoesNotRecognizeNonOverloadableSymbolKinds() async throws {
49364936
enableFeatureFlag(\.isExperimentalOverloadedSymbolPresentationEnabled)
49374937

4938-
let nonOverloadableKindIDs = SymbolGraph.Symbol.KindIdentifier.allCases.filter { !$0.isOverloadableKind }
4938+
let nonOverloadableKindIDs = SymbolGraph.Symbol.KindIdentifier.allCases.filter {
4939+
!$0.isOverloadableKind &&
4940+
!$0.isSnippetKind && // avoid mixing snippets with "real" symbols
4941+
$0 != .module // avoid creating multiple modules
4942+
}
49394943
// Generate a 4 symbols with the same name for every non overloadable symbol kind
49404944
let symbols: [SymbolGraph.Symbol] = nonOverloadableKindIDs.flatMap { [
49414945
makeSymbol(id: "first-\($0.identifier)-id", kind: $0, pathComponents: ["SymbolName"]),

0 commit comments

Comments
 (0)