test(cli): bound selector regression startup work per case

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
This commit is contained in:
N0zoM1z0andgensokyo-dev authored and gensokyo-dev committed 2026-11-11 14:43:19 +08:00
1 parent 1de3298eeb
commit 160d2ecdb5
1 file changed
+45 -40
+45 -40
View File
@@ -221,44 +221,49 @@ cliTest(
},
);
cliTest(
"compares native address values without folding symbols, spaces or text queries",
async ({ cli }) => {
for (const [command, option] of [
["xrefs", "address"],
["function", "procedure"],
["instructions", "procedure"],
["decompile", "procedure"],
["inspect-native-api", "procedure"],
]) {
for (const [left, right, code] of [
["0x1a", "0x001A", "target_unavailable"],
["ram:0x1", "RAM:0x1", "invalid_request"],
["Symbol", "symbol", "invalid_request"],
]) {
const result = await cli.run({
arguments: [
command!,
"does-not-exist",
left!,
`--${option}=${right}`,
"--json",
],
});
expect(result.json, `${command}: ${left}/${right}`).toMatchObject({
code,
});
for (const [command, option] of [
["xrefs", "address"],
["function", "procedure"],
["instructions", "procedure"],
["decompile", "procedure"],
["inspect-native-api", "procedure"],
] as const) {
cliTest(
`admits equivalent native coordinates through ${command}`,
async ({ cli }) => {
const result = await cli.run({
arguments: [
command,
"does-not-exist",
"0x1a",
`--${option}=0x001A`,
"--json",
],
});
expect(result.json).toMatchObject({ code: "target_unavailable" });
if (command === "xrefs") {
for (const [left, right] of [
["ram:0x1", "RAM:0x1"],
["Symbol", "symbol"],
] as const) {
const conflict = await cli.run({
arguments: [
command,
"does-not-exist",
left,
`--${option}=${right}`,
"--json",
],
});
expect(conflict.json).toMatchObject({ code: "invalid_request" });
}
}
}
const result = await cli.run({
arguments: [
"search",
"does-not-exist",
"0x1a",
"--pattern=0x1A",
"--json",
],
});
expect(result.json).toMatchObject({ code: "invalid_request" });
},
);
},
);
}
cliTest("keeps address-looking search text exact", async ({ cli }) => {
const result = await cli.run({
arguments: ["search", "does-not-exist", "0x1a", "--pattern=0x1A", "--json"],
});
expect(result.json).toMatchObject({ code: "invalid_request" });
});