| 1 | /*++ |
| 2 | |
| 3 | Copyright (c) Microsoft. All rights reserved. |
| 4 | |
| 5 | Module Name: |
| 6 | |
| 7 | WSLCE2EImageTests.cpp |
| 8 | |
| 9 | Abstract: |
| 10 | |
| 11 | This file contains end-to-end tests for WSLC. |
| 12 | --*/ |
| 13 | |
| 14 | #include "precomp.h" |
| 15 | #include "windows/Common.h" |
| 16 | #include "WSLCExecutor.h" |
| 17 | #include "WSLCE2EHelpers.h" |
| 18 | #include "Argument.h" |
| 19 | |
| 20 | namespace WSLCE2ETests { |
| 21 | using namespace wsl::shared; |
| 22 | |
| 23 | class WSLCE2EImageTests |
| 24 | { |
| 25 | WSLC_TEST_CLASS(WSLCE2EImageTests) |
| 26 | |
| 27 | WSLC_TEST_METHOD(WSLCE2E_Image_HelpCommand) |
| 28 | { |
| 29 | auto result = RunWslc(L"image --help"); |
| 30 | result.Verify({.Stderr = L"", .ExitCode = 0}); |
| 31 | VERIFY_IS_FALSE(result.Stdout.value().empty()); |
| 32 | } |
| 33 | |
| 34 | WSLC_TEST_METHOD(WSLCE2E_Image_NoSubcommand_ShowsHelp) |
| 35 | { |
| 36 | auto result = RunWslc(L"image"); |
| 37 | result.Verify({.Stderr = L"", .ExitCode = 0}); |
| 38 | VERIFY_IS_FALSE(result.Stdout.value().empty()); |
| 39 | } |
| 40 | |
| 41 | WSLC_TEST_METHOD(WSLCE2E_Image_InvalidCommand_DisplaysErrorMessage) |
| 42 | { |
| 43 | auto result = RunWslc(L"image INVALID_CMD"); |
| 44 | result.Verify({.Stdout = L"", .ExitCode = 1}); |
| 45 | VERIFY_IS_TRUE(result.StderrContainsSubstring(L"Unrecognized command: 'INVALID_CMD'")); |
| 46 | } |
| 47 | }; |
| 48 | } // namespace WSLCE2ETests |