-
Notifications
You must be signed in to change notification settings - Fork 92
Open
Description
I saw the issue #83 was implemented however I had some observations.
Given a source file source.swift;
#if DEBUG
import X
#elseif RELEASE
import Y
#endif
/// @mockable
protocol SwiftTest {}mockolo -srcs source.swift -d Mock.swift && cat Mock.swift outputs;
#if DEBUG
import X
#endif
#if RELEASE
import Y
#endifwhich is reflected correctly.
However;
#if DEBUG
import X
#else
import Y
#endif
/// @mockable
protocol SwiftTest {}outputs;
import X
import Y
#if DEBUG
import X
#endifwhich is incorrect. import Y should only be there for #else case.
Another observation (I don't know if this is supported or not) I had was compiler directives are not working inside the protocol definitions.
/// @mockable
protocol SwiftCompilerTest {
#if compiler(<4.0)
func swiftLessThan4()
#else
func swift()
#endif
}outputs;
class SwiftCompilerTestMock: SwiftCompilerTest {
init() { }
#if compiler(<4.0)
private(set) var swiftLessThan4CallCount = 0
var swiftLessThan4Handler: (() -> ())?
func swiftLessThan4() {
swiftLessThan4CallCount += 1
if let swiftLessThan4Handler = swiftLessThan4Handler {
swiftLessThan4Handler()
}
}
#endif
}func swift() seems to be completely ignored in this case.
- mockolo version :
2.1.1 - swift version:
swift: swiftlang-6.0.0.9.10 clang-1600.0.26.2
Metadata
Metadata
Assignees
Labels
No labels