Skip to content

Commit

Permalink
Merge pull request #141 from uber/fix-access
Browse files Browse the repository at this point in the history
Don't apply access level to processed typealias models
  • Loading branch information
EspressoCup authored Apr 20, 2021
2 parents 6793499 + 447c3e6 commit b0b9815
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Sources/Mockolo/Executor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -239,5 +239,5 @@ public struct Version {
public let value: String

/// The current Mockolo version.
public static let current = Version(value: "1.3.1")
public static let current = Version(value: "1.3.2")
}
2 changes: 1 addition & 1 deletion Sources/MockoloFramework/Models/TypeAliasModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ final class TypeAliasModel: Model {
self.modelDescription = modelDescription
self.overrideTypes = overrideTypes
self.useDescription = useDescription
self.addAcl = encloserType == .protocolType
self.addAcl = encloserType == .protocolType && !processed
// If there's an override typealias value, set it to type
if let val = overrideTypes?[self.name] {
self.type = Type(val)
Expand Down
24 changes: 24 additions & 0 deletions Tests/TestPATs/FixturePAT.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,30 @@ class BazMock: Baz {
}
"""

let simplePat =
"""
/// \(String.mockAnnotation)(typealias: T = String)
public protocol FooBar: Foo {
associatedtype T
}
"""
let parentPatMock =
"""
public class FooMock: Foo {
public init() { }
public typealias T = String
}
"""
let patWithParentMock =
"""
public class FooBarMock: FooBar {
public init() { }
public typealias T = String
}
"""


let patOverride =
"""
Expand Down
6 changes: 6 additions & 0 deletions Tests/TestPATs/ProtocolAssociatedTypeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ class ProtocolAssociatedTypeTests: MockoloTestCase {
dstContent: patOverrideMock)
}

func testPATWithParentMock() {
verify(srcContent: simplePat,
mockContent: parentPatMock,
dstContent: patWithParentMock)
}

func testPATNameCollisions() {
verify(srcContent: patNameCollision,
dstContent: patNameCollisionMock)
Expand Down

0 comments on commit b0b9815

Please sign in to comment.