Skip to content

Commit 80877ce

Browse files
committed
finishing PR
1 parent 19e27f7 commit 80877ce

File tree

2 files changed

+12
-27
lines changed

2 files changed

+12
-27
lines changed

Sources/SyntaxKit/Expressions/FunctionCallExp.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public struct FunctionCallExp: CodeBlock {
122122
}
123123
)
124124

125-
var functionCall = FunctionCallExprSyntax(
125+
let functionCall = FunctionCallExprSyntax(
126126
calledExpression: ExprSyntax(
127127
MemberAccessExprSyntax(
128128
base: baseExpr,

Tests/SyntaxKitTests/Unit/Integration/OptionsMacroIntegrationTests.swift

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -79,24 +79,16 @@ internal struct OptionsMacroIntegrationTests {
7979

8080
@Test internal func testCompleteOptionsMacroWorkflow() {
8181
// This test demonstrates the complete workflow that the Options macro would use
82+
// for an enum WITH raw values
8283

83-
// Step 1: Determine if enum has raw values (simulated)
84-
let hasRawValues = true
8584
let enumName = "TestEnum"
8685

87-
// Step 2: Create the appropriate mappedValues variable
88-
let mappedValuesVariable: Variable
89-
if hasRawValues {
90-
let keyValues: [Int: String] = [1: "first", 2: "second", 3: "third"]
91-
mappedValuesVariable = Variable(.let, name: "mappedValues", equals: keyValues)
92-
.withExplicitType().static()
93-
} else {
94-
let caseNames: [String] = ["first", "second", "third"]
95-
mappedValuesVariable = Variable(.let, name: "mappedValues", equals: caseNames)
96-
.withExplicitType().static()
97-
}
98-
99-
// Step 3: Create the extension
86+
// Create the mappedValues variable for enum with raw values
87+
let keyValues: [Int: String] = [1: "first", 2: "second", 3: "third"]
88+
let mappedValuesVariable = Variable(.let, name: "mappedValues", equals: keyValues)
89+
.withExplicitType().static()
90+
91+
// Create the extension
10092
let extensionDecl = Extension(enumName) {
10193
TypeAlias("MappedType", equals: "String")
10294
mappedValuesVariable
@@ -117,19 +109,12 @@ internal struct OptionsMacroIntegrationTests {
117109
@Test internal func testOptionsMacroWorkflowWithoutRawValues() {
118110
// Test the workflow for enums without raw values
119111

120-
let hasRawValues = false
121112
let enumName = "SimpleEnum"
122113

123-
let mappedValuesVariable: Variable
124-
if hasRawValues {
125-
let keyValues: [Int: String] = [1: "first", 2: "second"]
126-
mappedValuesVariable = Variable(.let, name: "mappedValues", equals: keyValues)
127-
.withExplicitType().static()
128-
} else {
129-
let caseNames: [String] = ["first", "second"]
130-
mappedValuesVariable = Variable(.let, name: "mappedValues", equals: caseNames)
131-
.withExplicitType().static()
132-
}
114+
// Create the mappedValues variable for enum without raw values
115+
let caseNames: [String] = ["first", "second"]
116+
let mappedValuesVariable = Variable(.let, name: "mappedValues", equals: caseNames)
117+
.withExplicitType().static()
133118

134119
let extensionDecl = Extension(enumName) {
135120
TypeAlias("MappedType", equals: "String")

0 commit comments

Comments
 (0)