mirror of
https://github.com/cocos/cocos-engine.git
synced 2026-09-09 09:08:54 +08:00
* Binary serialization * Update snapshots * Update * rename option ccon -> useCCON * Missing script * encodeCCONJson: chunks -> chunkURLs * Update * (de)serializeSymbol -> (de)serializeTag; * CustomizedSerializable -> CustomSerializable * _deserializePrimitiveObject -> _fillPlainObject * Unify CCClass CCClassConstructor * encodeCCONJson -> parseCCONJson * Custom serializable * Move (de)serializeSuper(This) from context into global * property -> read(write)Property; (de)serializeThis(Super) -> (read)writeThis(Super) * CI and lint * Mock cc env
26 lines
809 B
TypeScript
26 lines
809 B
TypeScript
|
|
import { ccclass } from '../../../cocos/core/data/decorators';
|
|
import { property } from '../../../cocos/core/data/decorators/property';
|
|
import { deserialize } from '../../../cocos/core/data/deserialize';
|
|
|
|
@ccclass('Foo')
|
|
class Foo { @property foo!: Foo | null; }
|
|
|
|
const EXPECTED_CAPACITY = 900;
|
|
|
|
test(`Deserialization capacity`, () => {
|
|
const fooSerialized = createVeryDeepFoo(EXPECTED_CAPACITY);
|
|
expect(() => deserialize(fooSerialized, undefined, undefined)).not.toThrow();
|
|
});
|
|
|
|
function createVeryDeepFoo (depth: number) {
|
|
const serializedDocument: Record<string, unknown>[] = [];
|
|
for (let i = 0; i < depth; ++i) {
|
|
serializedDocument.push({
|
|
__type__: 'Foo',
|
|
foo: i === depth - 1 ? null : { __id__: i + 1 },
|
|
});
|
|
}
|
|
return serializedDocument;
|
|
}
|