Initial commit

Signed-off-by: Ilan Bigio <ilan@openai.com>
This commit is contained in:
Ilan Bigio
2025-04-16 12:56:08 -04:00
commit 59a180ddec
163 changed files with 30587 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
import { formatCommandForDisplay } from "./format-command";
import { describe, test, expect } from "vitest";
describe("formatCommandForDisplay()", () => {
test("ensure empty string arg appears in output", () => {
expect(formatCommandForDisplay(["echo", ""])).toEqual("echo ''");
});
test("ensure special characters are properly escaped", () => {
expect(formatCommandForDisplay(["echo", "$HOME"])).toEqual("echo \\$HOME");
});
test("ensure quotes are properly escaped", () => {
expect(formatCommandForDisplay(["echo", "I can't believe this."])).toEqual(
'echo "I can\'t believe this."',
);
expect(
formatCommandForDisplay(["echo", 'So I said, "No ma\'am!"']),
).toEqual('echo "So I said, \\"No ma\'am\\!\\""');
});
});