You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(runtime): Never check for availability of protocols
Apple regularly create new protocols and move existing
interface members there. E.g. iOS 12.0 introduced the
UIFocusItemScrollableContainer protocol in UIKit which
contained members that have existed in UIScrollView
since iOS 2.0.
* Create `findProtocol` function in `GlobalTable`
* Use it instead of `findMeta` everwhere where a
protocol is looked for
* Add tests
refs #1084
expect(Object.getPrototypeOf(TNSInterfaceNeverAvailableDescendant).toString()).toBe(TNSInterfaceAlwaysAvailable.toString(),"TNSInterfaceNeverAvailable base class should be skipped as it is unavailable");
80
80
});
81
+
82
+
it("Members of a protocol which is unavailable should be skipped only when not implemented by class",function(){
83
+
expect(Object.getOwnPropertyNames(TNSInterfaceAlwaysAvailable)).toContain("staticPropertyFromProtocolNeverAvailable","TNSProtocolNeverAvailable static properties that are implemented should be present although the protocol is unavailable");
84
+
expect(Object.getOwnPropertyNames(TNSInterfaceAlwaysAvailable)).not.toContain("staticPropertyFromProtocolNeverAvailableNotImplemented","TNSProtocolNeverAvailable unimplemented static properties should be skipped");
85
+
expect(TNSInterfaceAlwaysAvailable.staticMethodFromProtocolNeverAvailable).toBeDefined("TNSProtocolNeverAvailable static methods that are implemented should be present although the protocol is unavailable");
86
+
expect(TNSInterfaceAlwaysAvailable.staticMethodFromProtocolNeverAvailableNotImplemented).toBeUndefined("TNSProtocolNeverAvailable unimplemented static methods should be skipped");
87
+
expect(Object.getOwnPropertyNames(TNSInterfaceAlwaysAvailable.prototype)).toContain("propertyFromProtocolNeverAvailable","TNSProtocolNeverAvailable properties that are implemented should be present although the protocol is unavailable");
88
+
expect(Object.getOwnPropertyNames(TNSInterfaceAlwaysAvailable.prototype)).not.toContain("propertyFromProtocolNeverAvailableNotImplemented","TNSProtocolNeverAvailable unimplemented properties should be skipped");
89
+
expect(newTNSInterfaceAlwaysAvailable().methodFromProtocolNeverAvailable).toBeDefined("TNSProtocolNeverAvailable methods that are implemented should be present although the protocol is unavailable");
90
+
expect(newTNSInterfaceAlwaysAvailable().methodFromProtocolNeverAvailableNotImplemented).toBeUndefined("TNSProtocolNeverAvailable unimplemented methods should be skipped");
91
+
});
92
+
93
+
it("Members of a protocol which is available should be present",function(){
94
+
constobj=newTNSInterfaceAlwaysAvailable();
95
+
letexpectedOutput="";
96
+
expect(Object.getOwnPropertyNames(TNSInterfaceAlwaysAvailable.prototype)).toContain("propertyFromProtocolAlwaysAvailable","TNSProtocolAlwaysAvailable properties should be present as it is available");
expect(Object.getOwnPropertyNames(TNSInterfaceAlwaysAvailable)).toContain("staticPropertyFromProtocolAlwaysAvailable","TNSProtocolAlwaysAvailable static properties should be present as it is available");
expect(TNSInterfaceAlwaysAvailable.staticMethodFromProtocolAlwaysAvailable).toBeDefined("TNSProtocolAlwaysAvailable static methods should be present as it is available");
0 commit comments