Fix the root directory completion test.
authorJim Ingham <jingham@apple.com>
Mon, 17 Jul 2023 17:50:17 +0000 (10:50 -0700)
committerJim Ingham <jingham@apple.com>
Mon, 17 Jul 2023 17:52:29 +0000 (10:52 -0700)
It was implicitly assumning that "/" would have no files in it, only
directories.  That's not true, for instance on macOS if you've navigated
to the root directory in the Finder...

Since we're assuming everything we check against is a directory, then we
need to filter the completion for that coming in.

lldb/test/API/functionalities/completion/TestCompletion.py

index 4b41326..74fb830 100644 (file)
@@ -485,7 +485,7 @@ class CommandLineCompletionTestCase(TestBase):
             "target create " + root_dir,
             list(
                 filter(
-                    lambda x: os.path.exists(x),
+                    lambda x: os.path.exists(x) and os.path.isdir(x),
                     map(lambda x: root_dir + x + os.sep, os.listdir(root_dir)),
                 )
             ),