aboutsummaryrefslogtreecommitdiff
path: root/src/zen-test/suggestion-tests.cpp
blob: 8607c7bd58a11ee69e3d51b902bcb373be56db44 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright Epic Games, Inc. All Rights Reserved.

#include <zencore/zencore.h>

#if ZEN_WITH_TESTS

#	include "zen-test.h"

#	include <zencore/testing.h>

namespace zen::tests {

TEST_SUITE_BEGIN("zen.suggestion");

// Unit tests for the suggestion algorithm live in zenutil (util.suggest). This
// integration test exists solely to verify the CLI wires the suggestion output
// into the "Unknown command" handler.
TEST_CASE("unknown_top_level_command_suggests_close_match")
{
	const ZenCommandResult Result = RunZen("stauts");

	CHECK(Result.ExitCode != 0);
	CHECK(Result.Output.find("Unknown command") != std::string::npos);
	CHECK_MESSAGE(Result.Output.find("status") != std::string::npos,
				  fmt::format("expected 'status' suggestion in output, got:\n{}", Result.Output));
}

TEST_SUITE_END();

}  // namespace zen::tests

#endif