Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions tests/stats/string_ops.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,11 +352,12 @@ describe("strNormalize — properties", () => {
});

describe("strRemovePrefix — properties", () => {
it("result never starts with prefix (when prefix non-empty)", () => {
it("removes exactly one occurrence of prefix when present, else returns str unchanged", () => {
fc.assert(
fc.property(fc.asciiString(), fc.asciiString({ minLength: 1 }), (str, prefix) => {
const result = strRemovePrefix(str, prefix);
return !(result.startsWith(prefix) && str.startsWith(prefix));
// Mirrors Python's str.removeprefix(): strips at most one leading occurrence.
return str.startsWith(prefix) ? prefix + result === str : result === str;
}),
);
});
Expand Down
Loading