mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 14:25:51 +00:00
test: 新增测试代码文件
This commit is contained in:
@@ -29,6 +29,14 @@ describe("parseArguments", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
test("handles escaped quotes inside quoted strings", () => {
|
||||
expect(parseArguments('foo "hello \\"world\\"" baz')).toEqual([
|
||||
"foo",
|
||||
'hello "world"',
|
||||
"baz",
|
||||
]);
|
||||
});
|
||||
|
||||
test("returns empty for empty string", () => {
|
||||
expect(parseArguments("")).toEqual([]);
|
||||
});
|
||||
@@ -101,6 +109,16 @@ describe("substituteArguments", () => {
|
||||
);
|
||||
});
|
||||
|
||||
test("replaces out-of-range index with empty string", () => {
|
||||
expect(substituteArguments("$5", "hello world")).toBe("");
|
||||
});
|
||||
|
||||
test("reuses same placeholder multiple times", () => {
|
||||
expect(substituteArguments("cmd $0 $1 $0", "alpha beta")).toBe(
|
||||
"cmd alpha beta alpha"
|
||||
);
|
||||
});
|
||||
|
||||
test("replaces named arguments", () => {
|
||||
expect(
|
||||
substituteArguments("file: $name", "test.txt", true, ["name"])
|
||||
|
||||
Reference in New Issue
Block a user