Software / code / prosody
Annotate
plugins/muc/config_form_sections.lib.lua @ 13762:81856814d74f 13.0
util.argparse: Fix bug (regression?) in argument parsing with --foo=bar
After recent changes, '--foo bar' was working, but '--foo=bar' was not. The
test had a typo (?) (bar != baz) and because util.argparse is not strict by
default, the typo was not caught.
The typo caused the code to take a different path, and bypassed the buggy
handling of --foo=bar options.
I've preserved the existing test (typo and all!) because it's still an
interesting test, and ensures no unintended behaviour changes compared to the
old code.
However I've added a new variant of the test, with strict mode enabled and the
typo fixed. This test failed due to the bug, and this commit introduces a fix.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Tue, 11 Mar 2025 18:27:36 +0000 |
| parent | 9036:bb4dcc555091 |
| rev | line source |
|---|---|
| 9036 | 1 module:hook("muc-config-form", function(event) |
| 2 table.insert(event.form, { | |
| 3 type = "fixed"; | |
| 4 value = "Room information"; | |
| 5 }); | |
| 6 end, 100); | |
| 7 | |
| 8 module:hook("muc-config-form", function(event) | |
| 9 table.insert(event.form, { | |
| 10 type = "fixed"; | |
| 11 value = "Access to the room"; | |
| 12 }); | |
| 13 end, 90); | |
| 14 | |
| 15 module:hook("muc-config-form", function(event) | |
| 16 table.insert(event.form, { | |
| 17 type = "fixed"; | |
| 18 value = "Permissions in the room"; | |
| 19 }); | |
| 20 end, 80); | |
| 21 | |
| 22 module:hook("muc-config-form", function(event) | |
| 23 table.insert(event.form, { | |
| 24 type = "fixed"; | |
| 25 value = "Other options"; | |
| 26 }); | |
| 27 end, 70); |