finish remaining todos, also, good bot

This commit is contained in:
Mike Griese
2020-07-09 12:37:02 -05:00
parent 7968b2a00e
commit c5208e6158
2 changed files with 35 additions and 6 deletions

View File

@@ -83,7 +83,7 @@ namespace TerminalAppLocalTests
TEST_METHOD(TestCommandsAndKeybindings);
TEST_METHOD(TestIterateCommands);
TEST_METHOD(TestIterateAutogenNamedCommands);
TEST_METHOD(TestIterateOnGeneratedNamedCommands);
TEST_METHOD(TestIterateOnBadJson);
TEST_METHOD(TestNestedCommands);
TEST_METHOD(TestNestedInNestedCommand);
@@ -2698,7 +2698,7 @@ namespace TerminalAppLocalTests
}
}
void SettingsTests::TestIterateAutogenNamedCommands()
void SettingsTests::TestIterateOnGeneratedNamedCommands()
{
// For this test, put an iterable command without a given `name` to
// replace. When we expand it, it should still work.
@@ -3699,7 +3699,7 @@ namespace TerminalAppLocalTests
void SettingsTests::TestUnbindNestedCommand()
{
// TODO: description
// Test that layering a command with `"commands": null` set will unbind a command that already exists.
const std::string settingsJson{ R"(
{
@@ -3781,7 +3781,8 @@ namespace TerminalAppLocalTests
void SettingsTests::TestRebindNestedCommand()
{
// TODO: description
// Test that layering a command with an action set on top of a command
// with nested commands replaces the nested commands with an action.
const std::string settingsJson{ R"(
{
@@ -3851,6 +3852,17 @@ namespace TerminalAppLocalTests
VERIFY_ARE_EQUAL(0u, settings._warnings.size());
VERIFY_ARE_EQUAL(1u, commands.size());
{
winrt::hstring commandName{ L"parent" };
auto commandProj = commands.at(commandName);
VERIFY_IS_NOT_NULL(commandProj);
winrt::com_ptr<implementation::Command> commandImpl;
commandImpl.copy_from(winrt::get_self<implementation::Command>(commandProj));
VERIFY_ARE_EQUAL(2u, commandImpl->_subcommands.size());
}
Log::Comment(L"Layer second bit of json, to unbind the original command.");
settings._ParseJsonString(settings1Json, false);
settings.LayerJson(settings._userSettings);
@@ -3858,6 +3870,23 @@ namespace TerminalAppLocalTests
_logCommandNames(commands);
VERIFY_ARE_EQUAL(0u, settings._warnings.size());
VERIFY_ARE_EQUAL(1u, commands.size());
{
winrt::hstring commandName{ L"parent" };
auto commandProj = commands.at(commandName);
VERIFY_IS_NOT_NULL(commandProj);
auto actionAndArgs = commandProj.Action();
VERIFY_IS_NOT_NULL(actionAndArgs);
VERIFY_ARE_EQUAL(ShortcutAction::NewTab, actionAndArgs.Action());
const auto& realArgs = actionAndArgs.Args().try_as<NewTabArgs>();
VERIFY_IS_NOT_NULL(realArgs);
winrt::com_ptr<implementation::Command> commandImpl;
commandImpl.copy_from(winrt::get_self<implementation::Command>(commandProj));
VERIFY_ARE_EQUAL(0u, commandImpl->_subcommands.size());
}
}
}

View File

@@ -255,7 +255,7 @@ namespace winrt::TerminalApp::implementation
// Function Description:
// - Helper to escape a string as a json string. This function will also
// trim off the leading and trailing double-qoutes, so the output string
// trim off the leading and trailing double-quotes, so the output string
// can be inserted directly into another json blob.
// Arguments:
// - input: the string to JSON escape.
@@ -298,7 +298,7 @@ namespace winrt::TerminalApp::implementation
}
// Method Description:
// - Iterate over all the provided comamnds, and recursively expand any
// - Iterate over all the provided commands, and recursively expand any
// commands with `iterateOn` set. If we successfully generated expanded
// commands for them, then we'll remove the original command, and add all
// the newly generated commands.