Parse network on a chatTabs entry
kind must be dereth, command optional (default dn, 1-32 of a-z0-9); a bad network is dropped and noted in the parse error, the entry is kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
4d4788ac7a
commit
fea33eb41b
2 changed files with 66 additions and 5 deletions
|
|
@ -35,6 +35,7 @@ internal static class Program
|
|||
WindowFrameless();
|
||||
ManifestBarMenu();
|
||||
ManifestChatTabs();
|
||||
ManifestChatTabNetwork();
|
||||
BarMenuHoverTiming();
|
||||
BarMenuReload();
|
||||
StackCheckAfterPluginDraw();
|
||||
|
|
@ -668,6 +669,36 @@ internal static class Program
|
|||
"17 rules: entry dropped, error set");
|
||||
}
|
||||
|
||||
private static void ManifestChatTabNetwork()
|
||||
{
|
||||
const string head = "{ \"chatTabs\": [ { \"server\": \"dw\", \"id\": \"a\", \"name\": \"A\", \"rules\": []";
|
||||
SectionManifest m = SectionManifestParser.Parse("DW", head + ", \"network\": { \"kind\": \"dereth\", \"command\": \"derethnetwork\" } } ] }", out string err);
|
||||
Case("manifest: chatTabs network present");
|
||||
Check(err.Length == 0 && m.ChatTabs.Length == 1 && m.ChatTabs[0].Network == new SectionNetworkDecl("dereth", "derethnetwork"), "kind and command parse: " + err);
|
||||
|
||||
Case("manifest: chatTabs network absent");
|
||||
m = SectionManifestParser.Parse("DW", head + " } ] }", out err);
|
||||
Check(err.Length == 0 && m.ChatTabs.Length == 1 && m.ChatTabs[0].Network == null, "no network key = null: " + err);
|
||||
|
||||
Case("manifest: chatTabs network bad kind");
|
||||
m = SectionManifestParser.Parse("DW", head + ", \"network\": { \"kind\": \"irc\", \"command\": \"dn\" } } ] }", out err);
|
||||
Check(m.ChatTabs.Length == 1 && m.ChatTabs[0].Network == null && err.Contains("network"), "key dropped, entry kept, error notes it: " + err);
|
||||
|
||||
Case("manifest: chatTabs network bad command");
|
||||
string[] bad = { "Dn", "d n", "/dn", "", new string('a', 33) };
|
||||
for (int i = 0; i < bad.Length; i++)
|
||||
{
|
||||
m = SectionManifestParser.Parse("DW", head + ", \"network\": { \"kind\": \"dereth\", \"command\": \"" + bad[i] + "\" } } ] }", out err);
|
||||
Check(m.ChatTabs.Length == 1 && m.ChatTabs[0].Network == null && err.Contains("network"), "key dropped, entry kept, error notes it: '" + bad[i] + "'");
|
||||
}
|
||||
m = SectionManifestParser.Parse("DW", head + ", \"network\": { \"kind\": \"dereth\", \"command\": \"" + new string('a', 32) + "\" } } ] }", out err);
|
||||
Check(err.Length == 0 && m.ChatTabs[0].Network?.Command.Length == 32, "32 characters is allowed");
|
||||
|
||||
Case("manifest: chatTabs network default command");
|
||||
m = SectionManifestParser.Parse("DW", head + ", \"network\": { \"kind\": \"dereth\" } } ] }", out err);
|
||||
Check(err.Length == 0 && m.ChatTabs[0].Network == new SectionNetworkDecl("dereth", "dn"), "absent command = dn: " + err);
|
||||
}
|
||||
|
||||
private static void ManifestBarMenu()
|
||||
{
|
||||
Case("plugin windows: barMenu (v95)");
|
||||
|
|
|
|||
Loading…
Reference in a new issue