Poll: help fallback, // separators, quoted questions, multi-vote

This commit is contained in:
Fisto
2026-09-11 16:07:21 +02:00
parent ace0bb18ff
commit 1dd573e334
5 changed files with 114 additions and 24 deletions
+9
View File
@@ -181,6 +181,15 @@ function entry(id: number, trusted: boolean): PuppetMessage {
{
assert.deepEqual(parsePoll("Lunch? | Pizza | Sushi"), { question: "Lunch?", options: ["Pizza", "Sushi"] });
assert.deepEqual(parsePoll("Q | A | B | C | D"), { question: "Q", options: ["A", "B", "C", "D"] });
assert.deepEqual(parsePoll('"What country is best" Sweden // Denmark // Madagaskar'), {
question: "What country is best",
options: ["Sweden", "Denmark", "Madagaskar"]
});
// the whitespace guard keeps URLs together
assert.deepEqual(parsePoll('"Links?" https://a.example // https://b.example'), {
question: "Links?",
options: ["https://a.example", "https://b.example"]
});
assert.equal(parsePoll("Q | A"), undefined);
assert.equal(parsePoll("Q | A | B | C | D | E"), undefined);
assert.equal(parsePoll(`Q | ${"x".repeat(100)} | B`), undefined);