Commit Graph

14 Commits

Author SHA1 Message Date
Florian Gamböck da987582a6 Check for correct ordering of completed items
The correct and consistent ordering is lexicographic. Not mtime, not
ctime, but pure lexicographic ordering.
2017-08-09 21:47:07 +02:00
Florian Gamböck 7ab57e1953 Check for not completing lone directories
Even if there is a sole directory with the name of the current
completion item, if it does not start with `./` then do not complete it!
2017-08-09 21:47:07 +02:00
Florian Gamböck 51e5381b67 Check for local directory completion
A directory in the current working directory (starting with `./`) should
be completed with a slash appended.
2017-08-09 21:47:07 +02:00
Florian Gamböck 79bdcc9ee1 Create some directories with ambiguous prefix
The chaotic order is intended. Some completion algorithms tend to sort
their results by modification time or something similar.

The "huge" number of directories is also intended. With more items the
chance is higher to hit a bug if no sorting took place.

Since Zsh just completes non-empty directories, some files have to be
created, too.
2017-08-09 21:47:07 +02:00
Florian Gamböck 8a13f1cb75 Check for command with directory in PWD
Even if there is a directory in the current working directory with the
same name as a command, the directory must not be completed.

So, if we want to complete "true" and there is a directory "true" in the
current working directory, the completion list has to be just {"true"},
not {"true", "true/"}, or anything else!
2017-08-09 21:44:55 +02:00
Florian Gamböck c296a0b91d Remove obsolete redefinition of popen
With the directory being changed via luafilesystem, there is no need to
redefine internal functions.
2017-08-09 21:44:55 +02:00
Florian Gamböck 8e2d844f60 Use luafilesystem to change directory
In some circumstances, if not every syscall was somehow redefined, the
directory was not changed correctly. With luafilesystem.chdir it is
assured that we are in the wanted directory afterwards.
2017-08-09 21:44:55 +02:00
Florian Gamböck c279dd32ce Make some directories in testing area 2017-08-09 21:44:55 +02:00
Florian Gamböck 13b3a18a75 Extend prefix for local file
Since we want some folders in the testing area, we need to be a bit more
explicit about the file completion.
2017-08-09 21:44:14 +02:00
Florian Gamböck 829e887806 Create and destroy temp PATH in tests
Since busted seems to spawn isolated child processes for every test
suite, the temporary PATH directories have to be created at the
beginning and destroyed at the end of a test suite.
2017-08-07 19:44:27 +02:00
Florian Gamböck a716009caa Set up isolated PATH directory for testing
We cannot possibly know what is in the PATH of a user. The completion
test cases however assume that there is nothing else in the PATH that
starts with `true` other than `true` itself.

These two methods create or respectively destroy a temporary PATH
directory especially for testing. We can put commands in there via
symlinks and verify the correct functionality of the complete commands.
The PATH environment variable is set and reset via GLib.
2017-08-07 19:44:27 +02:00
Daniel Hahler 9938fc8a05 spec/awful/completion_spec.lua: handle missing bash/zsh (#1889)
Fixes https://github.com/awesomeWM/awesome/issues/1882.

tests: spec/awful/completion_spec.lua: fix teardown for dirs

Fixes https://github.com/awesomeWM/awesome/issues/1888.
2017-07-03 21:28:13 +02:00
Daniel Hahler 4eddfacf51 lib/awful/completion.lua: handle missing SHELL environ var (#1897) 2017-07-03 19:26:10 +02:00
Daniel Hahler 0c97d1aa95 Add spec/awful/completion_spec.lua 2017-06-26 22:45:11 +02:00