uber / mockolo

Efficient Mock Generator for Swift
Apache License 2.0
804 stars 85 forks source link

Mock of class with computed properties causes compile error. #245

Open kaniza opened 10 months ago

kaniza commented 10 months ago

Generating a mock of a class with the following properties will result in a compile-time error in the callCount section.

var isOpen:Bool { return true }

Error:. Cannot observe read-only property 'isOpen'; it can't change

The relevant code is this part: override var isOpen: Bool { didSet { isOpenSetCallCount += 1 }

I think callCount is not necessary for read-only Computed Property.

mockolo: 2.0.0 (latest in Homebrew) macOS 13.5 Swfit: 5.8.1 Xcode: 14.3.1