Files
WSL/test/windows/wslc/WSLCCLIOptionsParserUnitTests.cpp
CopilotandAmelBawa-msft 8cd5ef1ff9 Initial support for wslc network commands (#40564)
* Init network commands

Co-authored-by: AmelBawa-msft <104940545+AmelBawa-msft@users.noreply.github.com>

* Integrate network inspect

Co-authored-by: AmelBawa-msft <104940545+AmelBawa-msft@users.noreply.github.com>

* Clang format

Co-authored-by: AmelBawa-msft <104940545+AmelBawa-msft@users.noreply.github.com>

* fix: address review feedback in network port to master

Agent-Logs-Url: https://github.com/microsoft/WSL/sessions/db7c0afc-316b-46bf-aae1-71244fd15e16

Co-authored-by: AmelBawa-msft <104940545+AmelBawa-msft@users.noreply.github.com>

* Sync with latest

* Clang format

* Added test

* Update test

* Update string

* Promote parsers

* Clang format

* Remove comments

* Fix test

---------

Co-authored-by: AmirMS <104940545+AmelBawa-msft@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-06-04 19:44:43 -07:00

48 lines
1.2 KiB
C++

/*++
Copyright (c) Microsoft. All rights reserved.
Module Name:
WSLCCLIOptionsParserUnitTests.cpp
Abstract:
This file contains unit tests for WSLC CLI driver option parsing.
--*/
#include "precomp.h"
#include "windows/Common.h"
#include "WSLCCLITestHelpers.h"
#include "ArgumentValidation.h"
using namespace wsl::windows::wslc;
namespace WSLCCLIOptionsParserUnitTests {
class WSLCCLIOptionsParserUnitTests
{
WSLC_TEST_CLASS(WSLCCLIOptionsParserUnitTests)
TEST_METHOD(WSLCCLIOptionsParser_ValidOptions)
{
std::vector<std::tuple<std::wstring, std::string, std::string>> validOptions = {
{L"SizeBytes=3145728", "SizeBytes", "3145728"},
{L"ReadOnly", "ReadOnly", ""},
{L"key=", "key", ""},
{L"=value", "", "value"},
{L"", "", ""},
{L"key=a=b=c", "key", "a=b=c"},
};
for (const auto& [input, expectedKey, expectedValue] : validOptions)
{
auto result = validation::ParseDriverOption(input);
VERIFY_ARE_EQUAL(expectedKey, result.first);
VERIFY_ARE_EQUAL(expectedValue, result.second);
}
}
};
} // namespace WSLCCLIOptionsParserUnitTests