mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-20 05:31:30 +00:00
test: dedupe utility and config suites
This commit is contained in:
@@ -6,18 +6,15 @@ import {
|
||||
} from "./exec-inline-eval.js";
|
||||
|
||||
describe("exec inline eval detection", () => {
|
||||
it("detects common interpreter eval flags", () => {
|
||||
const cases = [
|
||||
{ argv: ["python3", "-c", "print('hi')"], expected: "python3 -c" },
|
||||
{ argv: ["/usr/bin/node", "--eval", "console.log('hi')"], expected: "node --eval" },
|
||||
{ argv: ["perl", "-E", "say 1"], expected: "perl -e" },
|
||||
{ argv: ["osascript", "-e", "beep"], expected: "osascript -e" },
|
||||
];
|
||||
for (const testCase of cases) {
|
||||
const hit = detectInterpreterInlineEvalArgv(testCase.argv);
|
||||
expect(hit).not.toBeNull();
|
||||
expect(describeInterpreterInlineEval(hit!)).toBe(testCase.expected);
|
||||
}
|
||||
it.each([
|
||||
{ argv: ["python3", "-c", "print('hi')"], expected: "python3 -c" },
|
||||
{ argv: ["/usr/bin/node", "--eval", "console.log('hi')"], expected: "node --eval" },
|
||||
{ argv: ["perl", "-E", "say 1"], expected: "perl -e" },
|
||||
{ argv: ["osascript", "-e", "beep"], expected: "osascript -e" },
|
||||
] as const)("detects interpreter eval flags for %j", ({ argv, expected }) => {
|
||||
const hit = detectInterpreterInlineEvalArgv([...argv]);
|
||||
expect(hit).not.toBeNull();
|
||||
expect(describeInterpreterInlineEval(hit!)).toBe(expected);
|
||||
});
|
||||
|
||||
it("ignores normal script execution", () => {
|
||||
|
||||
Reference in New Issue
Block a user