mirror of
https://github.com/morluto/rea.git
synced 2026-11-19 21:23:45 +00:00
fix(entropy): name offset when the byte window starts past EOF (#6495)
Fixes #6482 Co-authored-by: Abelo9996 <Abelo9996@users.noreply.github.com>
This commit is contained in:
1 parent
8f91e60558
commit
e8dad898da
3 files changed
+23
-2
No files matched your search
@@ -69,6 +69,22 @@ it("rejects missing files, non-files and windows beyond EOF, but accepts empty w
|
||||
).toContainEqual(expect.stringContaining("reports a size of 0"));
|
||||
});
|
||||
|
||||
it.each([
|
||||
[{ offset: 2048 }, "offset"],
|
||||
[{ offset: 2048, length: 0 }, "offset"],
|
||||
[{ offset: 512, length: 1024 }, "length"],
|
||||
])("names the selector that puts %o past EOF", async (window, field) => {
|
||||
const root = await createTestTempDirectory("rea-entropy-window-");
|
||||
const path = join(root, "bytes");
|
||||
await writeFile(path, Buffer.alloc(1024));
|
||||
const result = await new ByteEntropyService().inspect({ path, ...window });
|
||||
if (result.ok) throw new Error("Expected an out-of-file window to fail");
|
||||
expect(projectAnalysisError(result.error)).toMatchObject({
|
||||
code: "invalid_request",
|
||||
details: { issues: [{ path: [field], reason: "invalid_value" }] },
|
||||
});
|
||||
});
|
||||
|
||||
it.skipIf(process.platform !== "linux")(
|
||||
"marks a generated /proc file that reports size 0 as not shown empty",
|
||||
async () => {
|
||||
|
||||
Reference in new issue
Block a user