Skip to content

Commit

Permalink
Add Spy generating
Browse files Browse the repository at this point in the history
  • Loading branch information
Kryštof Matěj committed Sep 13, 2023
1 parent 9601526 commit fe19c36
Show file tree
Hide file tree
Showing 12 changed files with 587 additions and 1,087 deletions.
4 changes: 4 additions & 0 deletions Rubicon/Sources/Rubicon/Domain/StructDeclaration.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
struct StructDeclaration: Equatable {
let name: String
let variables: [VarDeclaration]
}
330 changes: 0 additions & 330 deletions Rubicon/Sources/Rubicon/Generator/CreateSpyInteractor.swift

This file was deleted.

6 changes: 6 additions & 0 deletions Rubicon/Sources/Rubicon/Generator/FunctionNameGenerator.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
protocol FunctionNameGenerator {
func makeUniqueName(for function: FunctionDeclaration, in functions: [FunctionDeclaration]) -> String
func makeStructUniqueName(for function: FunctionDeclaration, in functions: [FunctionDeclaration]) -> String
}

final class FunctionNameGeneratorImpl: FunctionNameGenerator {
Expand Down Expand Up @@ -36,4 +37,9 @@ final class FunctionNameGeneratorImpl: FunctionNameGenerator {
private func isFunctionNameUnique(_ function: FunctionDeclaration, in functions: [FunctionDeclaration]) -> Bool {
return !functions.contains(where: { $0.name == function.name && $0 != function })
}

func makeStructUniqueName(for function: FunctionDeclaration, in functions: [FunctionDeclaration]) -> String {
return makeFirstLetterCapitalized(in: makeUniqueName(for: function, in: functions))
}

}
Loading

0 comments on commit fe19c36

Please sign in to comment.