Poll: help fallback, // separators, quoted questions, multi-vote
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user