From 83b7658b0471ba3161eee1fed61781e69e9602f3 Mon Sep 17 00:00:00 2001 From: Martchus Date: Wed, 5 Jun 2019 23:49:53 +0200 Subject: [PATCH] Add test for Bash completion of directory names --- tests/argumentparsertests.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/argumentparsertests.cpp b/tests/argumentparsertests.cpp index 0c4d4f3..44eb883 100644 --- a/tests/argumentparsertests.cpp +++ b/tests/argumentparsertests.cpp @@ -668,6 +668,18 @@ void ArgumentParserTests::testBashCompletion() parser.printBashCompletion(3, argv5, 2, reader); } + // directory names + string directoryPath = iniFilePath.substr(0, iniFilePath.size() - 4); + filesArg.setValueCompletionBehavior(ValueCompletionBehavior::Directories); + parser.resetArgs(); + const char *const argv14[] = { "get", "--files", directoryPath.c_str() }; + { + // order for file names is not specified + const OutputCheck c("COMPREPLY=('" % directoryPath + "subdir' ); compopt -o filenames\n"); + reader.reset(argv14, argv14 + 3).read(); + parser.printBashCompletion(3, argv14, 2, reader); + } + // sub arguments const char *const argv6[] = { "set", "--" }; parser.resetArgs();