mirror of
https://github.com/morluto/rea
synced 2026-10-25 22:08:11 -04:00
test(managed): retain observed target changes across member remaps
This commit is contained in:
@@ -737,15 +737,16 @@ it.each([
|
||||
metadataOffset,
|
||||
image.length - metadataOffset,
|
||||
);
|
||||
if (layout.blob === null)
|
||||
throw new Error("Fixture requires a #Blob stream");
|
||||
const blobSize = layout.blob.size;
|
||||
const reference = layout.table(35)!;
|
||||
// ECMA-335 AssemblyRef: 8 version bytes, 4 flag bytes, then PublicKeyOrToken.
|
||||
// Keep its name valid while making that unrelated blob index invalid.
|
||||
if (layout.blobIndexSize === 2)
|
||||
image.writeUInt16LE(0xffff, reference.offset + 12);
|
||||
else image.writeUInt32LE(0xffff_ffff, reference.offset + 12);
|
||||
expect(() =>
|
||||
readAssemblyReference(image, layout, 1, layout.blob.size),
|
||||
).toThrow();
|
||||
expect(() => readAssemblyReference(image, layout, 1, blobSize)).toThrow();
|
||||
await put(root, `${managedDirectory}/Assembly-CSharp.dll`, image);
|
||||
const { report } = await inspect(root);
|
||||
expect(report.candidates.map((candidate) => candidate.family)).toEqual([
|
||||
|
||||
@@ -417,7 +417,7 @@ describe("managed member comparison", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("remaps renamed methods by exact CIL/signature without using names", () => {
|
||||
it("remaps renamed methods by exact CIL while retaining field target changes", () => {
|
||||
const leftBytes = buildManagedPeFixture();
|
||||
const rightBytes = buildManagedPeFixture({
|
||||
mvid: Buffer.from("00112233445566778899aabbccddeefe", "hex"),
|
||||
@@ -438,7 +438,7 @@ describe("managed member comparison", () => {
|
||||
expect(result.matching.exact_il_signature).toBe(1);
|
||||
expect(result.methods).toEqual([
|
||||
expect.objectContaining({
|
||||
status: "unchanged",
|
||||
status: "changed",
|
||||
left: expect.objectContaining({ token: "0x06000001", name: "Main" }),
|
||||
right: expect.objectContaining({ token: "0x06000001", name: "b" }),
|
||||
match: expect.objectContaining({
|
||||
@@ -446,7 +446,7 @@ describe("managed member comparison", () => {
|
||||
basis: "exact-il-signature",
|
||||
confidence: "exact",
|
||||
}),
|
||||
dimensions: [],
|
||||
dimensions: ["field-target"],
|
||||
}),
|
||||
]);
|
||||
expect(result.limitations).toContain(
|
||||
|
||||
Reference in New Issue
Block a user