Test that all classes are implemented (#933)

* Test that all classes are implemented

* Add PlDir to runtime

* Log raw ID when we can't find a class

* Add Maki class ids
This commit is contained in:
Jordan Eldredge 2019-09-27 09:30:06 -07:00 committed by GitHub
parent 73bc040136
commit d29868091d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 2 deletions

View file

@ -459,5 +459,13 @@ ConfigItem.getguid
ConfigAttribute.setdata
ConfigAttribute.getdata
ConfigAttribute.getparentitem
ConfigAttribute.getattributename"
ConfigAttribute.getattributename
PlDir.showcurrentlyplayingentry
FeedWatcher.setfeed
FeedWatcher.releasefeed
FeedWatcher.onfeedchange
Form.getcontentsheight
Form.newcell
Form.nextrow
Form.deleteall"
`;

View file

@ -78,6 +78,13 @@ describe("Maki classes", () => {
});
}
test("All classes are implemented", () => {
const getName = Klass => Klass.prototype.getclassname();
const actualNames = Object.values(runtime).map(getName);
const expectedNames = Object.values(objects).map(obj => obj.name);
expect(new Set(actualNames)).toEqual(new Set(expectedNames));
});
test("have no extra methods", () => {
// getclassname _should_ be implemented on Object and let each class inherit
// it. However it's far easier to implement it on each class directly, so

View file

@ -51,7 +51,9 @@ function getCallCountsFromMaki(buffer) {
const classId = maki.classes[method.typeOffset];
const klass = getClass(classId);
if (klass == null) {
throw new Error(`Unknown class ID: ${getFormattedId(classId)}`);
throw new Error(
`Unknown class ID: ${getFormattedId(classId)} aka ${classId} (raw)`
);
}
const parentClass = getFunctionObject(klass, method.name);
return `${parentClass.name}.${method.name.toLowerCase()}`;

View file

@ -39,6 +39,9 @@ import CheckBox from "./CheckBox";
import Config from "./Config";
import ConfigItem from "./ConfigItem";
import ConfigAttribute from "./ConfigAttribute";
import PlDir from "./PlDir";
import FeedWatcher from "./FeedWatcher";
import Form from "./Form";
const runtime = {
"516549714a510d87b5a6e391e7f33532": MakiObject,
@ -82,6 +85,22 @@ const runtime = {
"593dba224976d07771f452b90b405536": Config,
d40302824d873aab32128d87d5fcad6f: ConfigItem,
"24dec2834a36b76e249ecc8c736c6bc4": ConfigAttribute,
"61a7abad41f67d7980e1d0b1f4a40386": PlDir,
a5376fa1411a4e94ec05f6830a5fea5e: FeedWatcher,
"2d2d13764cb9be0ae6570cbcf599c9e4": Form,
/*
// https://github.com/captbaritone/webamp/pull/933#issuecomment-535690208
a5376fa1411a4e94ec05f6830a5fea5e: FeedWatcher,
6dcb05e448c28ac4f04993b14af50e91: AlbumArtLayer,
aee235ff498febd1e0d7af961a54d4da: ColorMgr,
b8e867b04da72715db53baa5acfefca1: Application,
f857beca41f18e197e093e97039f6439: CoreAdmin,
2825a91b4245d4885970f1aa7b4388cf: Core,
e2bbc14d417384f6ebb2b3bd5055662f: Frame,
836f8b2e4db4e0d10a0d7f93d1dcc804: File,
*/
};
export default runtime;