Fixes #2342 -- get_mimetype tests fail without file in PATH#2343
Fixes #2342 -- get_mimetype tests fail without file in PATH#2343alzwded wants to merge 1 commit intoolimorris:mainfrom
Conversation
|
It's early here but I don't understand this test |
|
I've only learnt about these two tests 30 minutes ago when I rebased to main :-P Initially, I wanted to add Going off the testcase descriptions, one tests that get_mimetype invokes the That's not what the tests were doing, though. This PR adds a mock for vim.fn.executable so that the test setup matches the testcase description. The implementation in utils.files first checks if there is a I don't particularly care if you accept this PR, but the docs say |
|
@olimorris the new Regarding this PR, I suggest the following changes:
|
c9c1497 to
f000ec4
Compare
1. In T["Files utils"]["get_mimetype"]["can invoke file"], we mock vim.fn.executable so that it returns 1 and triggers the (mocked) file command. This test makes sure the get_mimetype function can parse the output of the file command. 2. Rename T["Files utils"]["get_mimetype"]["works without file"] to T["Files utils"]["get_mimetype"]["works with fallback"], and mock vim.fn.executable to return 0 so that it never invokes the file command. This test makes sure the hardcoded map is working.
f000ec4 to
9af6d81
Compare
|
This PR is stale because it has been open for 30 days with no activity. |
Description
In tests_file.lua, mock vim.fn.executable to yield 1 or 0 depending on what the test is trying to test.
Related Issue(s)
filein PATH #2342Screenshots
Checklist
make allto ensure docs are generated, tests pass and my formatting is appliedCodeCompanion.hasin the init.lua file for my new feature