fix: file sizes from PowerShell, quoted mentions, dedupe and BOM
Co-Authored-By: Ovis Fast (Claude) <[email protected]>
This commit is contained in:
1 parent
761a80004a
commit
1ed04fe9be
5 files changed
+339
-94
No files matched your search
@@ -26,8 +26,11 @@ test("validateMany enforces count limit", () => {
|
||||
assert.equal(validateMany(files.slice(0, 100)).ok, true);
|
||||
});
|
||||
|
||||
test("mention", () => {
|
||||
test("mention: bare path, or quoted when it has whitespace", () => {
|
||||
assert.equal(mention(" /a/b "), "@/a/b");
|
||||
assert.equal(mention("/a b/c"), '@"/a b/c"');
|
||||
assert.equal(mention("C:\\Moje pliki\\x.png"), '@"C:\\Moje pliki\\x.png"');
|
||||
assert.equal(mention("/a\tb"), '@"/a\tb"');
|
||||
assert.equal(mention(""), "");
|
||||
assert.equal(mention(5), "");
|
||||
});
|
||||
@@ -39,12 +42,19 @@ test("removeMention removes only the standalone token", () => {
|
||||
|
||||
test("mention and removeMention with a space and Polish letters in the path", () => {
|
||||
const path = "/home/zażółć/gęsia jaźń/ęą.png";
|
||||
assert.equal(mention(path), `@${path}`);
|
||||
assert.equal(removeMention(`zobacz @${path} proszę`, path), "zobacz proszę");
|
||||
assert.equal(removeMention(`@${path}`, path), "");
|
||||
assert.equal(mention(path), `@"${path}"`);
|
||||
assert.equal(removeMention(`zobacz @"${path}" proszę`, path), "zobacz proszę");
|
||||
assert.equal(removeMention(`@"${path}"`, path), "");
|
||||
});
|
||||
|
||||
test("removeMention leaves a mention glued to a Polish letter alone", () => {
|
||||
assert.equal(removeMention("@src/aę a", "src/a"), "@src/aę a");
|
||||
assert.equal(removeMention("ę@src/a", "src/a"), "ę@src/a");
|
||||
});
|
||||
|
||||
test("removeMention takes the quoted form and the bare form out", () => {
|
||||
assert.equal(removeMention('see @"/a b/ęą.png" now', "/a b/ęą.png"), "see now");
|
||||
assert.equal(removeMention('@"/a b/ęą.png"', "/a b/ęą.png"), "");
|
||||
assert.equal(removeMention("see @/a/ęą.png now", "/a/ęą.png"), "see now");
|
||||
assert.equal(removeMention('see @"/a b/c.png"x now', "/a b/c.png"), 'see @"/a b/c.png"x now');
|
||||
});
|
||||
Reference in new issue
Block a user