Skip to content

Commit

Permalink
all tests use range of access levels
Browse files Browse the repository at this point in the history
  • Loading branch information
rnro committed Jan 6, 2025
1 parent 0878398 commit e4faa41
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions Tests/GRPCCodeGenTests/Internal/StructuredSwift+ImportTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,10 @@ extension StructuredSwiftTests {
}

@Test(
"preconcurrency import rendering"
"preconcurrency import rendering",
arguments: allAccessLevels
)
func preconcurrencyImports() throws {
func preconcurrencyImports(accessLevel: SourceGenerator.Config.AccessLevel) throws {
var dependencies = [Dependency]()
dependencies.append(
Dependency(
Expand All @@ -144,7 +145,7 @@ extension StructuredSwiftTests {

let expected =
"""
public import GRPCCore
\(accessLevel.level) import GRPCCore
@preconcurrency internal import Foo
@preconcurrency internal import enum Foo.Bar
#if os(Deq) || os(Der)
Expand All @@ -156,17 +157,18 @@ extension StructuredSwiftTests {

let imports = try StructuredSwiftTests.Import.translator.makeImports(
dependencies: dependencies,
accessLevel: .public,
accessLevel: accessLevel,
accessLevelOnImports: true
)

#expect(render(imports) == expected)
}

@Test(
"SPI import rendering"
"SPI import rendering",
arguments: allAccessLevels
)
func spiImports() throws {
func spiImports(accessLevel: SourceGenerator.Config.AccessLevel) throws {
var dependencies = [Dependency]()
dependencies.append(
Dependency(module: "Foo", spi: "Secret", accessLevel: .internal)
Expand All @@ -182,14 +184,14 @@ extension StructuredSwiftTests {

let expected =
"""
public import GRPCCore
\(accessLevel.level) import GRPCCore
@_spi(Secret) internal import Foo
@_spi(Secret) internal import enum Foo.Bar
"""

let imports = try StructuredSwiftTests.Import.translator.makeImports(
dependencies: dependencies,
accessLevel: .public,
accessLevel: accessLevel,
accessLevelOnImports: true
)

Expand Down

0 comments on commit e4faa41

Please sign in to comment.