aboutsummaryrefslogtreecommitdiff
path: root/src/zen-test/suggestion-tests.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2026-04-23 18:16:57 +0200
committerStefan Boberg <[email protected]>2026-04-23 18:16:57 +0200
commit0232b991cd7d8e3a2114ea30e4591dd3e7b65c36 (patch)
tree94730e7594fd09ae1fa820391ce311f6daf13905 /src/zen-test/suggestion-tests.cpp
parentFix forward declaration order for s_GotSigWinch and SigWinchHandler (diff)
parenttrace: declare Region event name fields as AnsiString (#1012) (diff)
downloadarchived-zen-sb/zen-help.tar.xz
archived-zen-sb/zen-help.zip
Merge branch 'main' into sb/zen-helpsb/zen-help
- Combine HelpCommand (this branch) with HistoryCommand (main) in zen CLI dispatcher - Keep filter-aware TuiPickOne rewrite; adopt main's ASCII arrow glyphs in doc comment
Diffstat (limited to 'src/zen-test/suggestion-tests.cpp')
-rw-r--r--src/zen-test/suggestion-tests.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/zen-test/suggestion-tests.cpp b/src/zen-test/suggestion-tests.cpp
new file mode 100644
index 000000000..8607c7bd5
--- /dev/null
+++ b/src/zen-test/suggestion-tests.cpp
@@ -0,0 +1,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