mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 17:28:27 -04:00
dev: Tests updated to find obsolete command strings. Already removed them in earlier commits, there were 10-15 commands which no longer exist
This commit is contained in:
@@ -99,31 +99,33 @@ namespace NadekoBot.Tests
|
|||||||
Assert.Warn("There are some unused entries in data/aliases.yml");
|
Assert.Warn("There are some unused entries in data/aliases.yml");
|
||||||
}
|
}
|
||||||
|
|
||||||
// [Test]
|
[Test]
|
||||||
// public void NoObsoleteCommandStrings()
|
public void NoObsoleteCommandStrings()
|
||||||
// {
|
{
|
||||||
// var stringsSource = new LocalFileStringsSource(responsesPath, commandsPath);
|
var stringsSource = new LocalFileStringsSource(responsesPath, commandsPath);
|
||||||
//
|
|
||||||
// var culture = new CultureInfo("en-US");
|
var culture = new CultureInfo("en-US");
|
||||||
//
|
|
||||||
// var isSuccess = true;
|
var methodNames = GetCommandMethodNames()
|
||||||
// var allCommandNames = CommandNameLoadHelper.LoadCommandNames(aliasesPath);
|
.ToHashSet();
|
||||||
// var enUsCommandNames = allCommandNames
|
|
||||||
// .Select(x => x.Value[0]) // first alias is command name
|
var isSuccess = true;
|
||||||
// .ToHashSet();
|
// var allCommandNames = CommandNameLoadHelper.LoadCommandStrings(commandsPath));
|
||||||
// foreach (var entry in stringsSource.GetCommandStrings()[culture.Name])
|
foreach (var entry in stringsSource.GetCommandStrings()[culture.Name])
|
||||||
// {
|
{
|
||||||
// // key is command name which should be specified in aliases[0] of any method name
|
var cmdName = entry.Key;
|
||||||
// var cmdName = entry.Key;
|
|
||||||
//
|
if (!methodNames.Contains(cmdName))
|
||||||
// if (!enUsCommandNames.Contains(cmdName))
|
{
|
||||||
// {
|
TestContext.Out.WriteLine($"'{cmdName}' from commands.en-US.yml doesn't have a matching command method.");
|
||||||
// TestContext.Out.WriteLine($"'{cmdName}' It's either obsolete or missing an alias entry.");
|
isSuccess = false;
|
||||||
// isSuccess = false;
|
}
|
||||||
// }
|
}
|
||||||
// }
|
|
||||||
//
|
if(isSuccess)
|
||||||
// Assert.IsTrue(isSuccess);
|
Assert.IsTrue(isSuccess);
|
||||||
// }
|
else
|
||||||
|
Assert.Warn("There are some unused command strings in data/strings/commands.en-US.yml");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user