-
-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: add macos and windows and more robust scandir tests #74
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,16 @@ local has_all_executables = function(execs) | |
return true | ||
end | ||
|
||
local contains = function(a, b) | ||
local found = 0 | ||
for _, v in ipairs(a) do | ||
for _, w in ipairs(b) do | ||
if v == w then found = found + 1 end | ||
end | ||
end | ||
return found == #b | ||
end | ||
|
||
describe('Job', function() | ||
describe('> cat manually >', function() | ||
it('should split simple stdin', function() | ||
|
@@ -106,7 +116,7 @@ describe('Job', function() | |
|
||
job:sync() | ||
|
||
assert.are.same(job:result(), { 'A=100' }) | ||
assert.are.same(true, contains(job:result(), { 'A=100' })) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Windows doesn't get a clean env. Or maybe it is a clean env but windows needs like 100 env vars to even function 🤣 Idk we just check that it contains now. Doesn't matter |
||
assert.are.same(job:result(), results) | ||
end) | ||
|
||
|
@@ -122,7 +132,7 @@ describe('Job', function() | |
|
||
job:sync() | ||
|
||
assert.are.same(job:result(), { 'A=100', 'B=test' }) | ||
assert.are.same(true, contains(job:result(), { 'A=100', 'B=test' })) | ||
assert.are.same(job:result(), results) | ||
end) | ||
|
||
|
@@ -138,7 +148,7 @@ describe('Job', function() | |
|
||
job:sync() | ||
|
||
assert.are.same(job:result(), { 'A=100' }) | ||
assert.are.same(true, contains(job:result(), { 'A=100' })) | ||
assert.are.same(job:result(), results) | ||
end) | ||
|
||
|
@@ -154,7 +164,7 @@ describe('Job', function() | |
|
||
job:sync() | ||
|
||
assert.are.same(job:result(), { 'A=This is a long env var' }) | ||
assert.are.same(true, contains(job:result(), { 'A=This is a long env var' })) | ||
assert.are.same(job:result(), results) | ||
end) | ||
|
||
|
@@ -170,7 +180,7 @@ describe('Job', function() | |
|
||
job:sync() | ||
|
||
assert.are.same(job:result(), { 'A=This is a long env var' }) | ||
assert.are.same(true, contains(job:result(), { 'A=This is a long env var' })) | ||
assert.are.same(job:result(), results) | ||
end) | ||
|
||
|
@@ -186,15 +196,7 @@ describe('Job', function() | |
|
||
job:sync() | ||
|
||
local expected = { 'A=100', 'B=test' } | ||
local found = { false, false } | ||
for k, v in ipairs(job:result()) do | ||
for _, w in ipairs(expected) do | ||
if v == w then found[k] = true end | ||
end | ||
end | ||
|
||
assert.are.same({ true, true }, found) | ||
assert.are.same(true, contains(job:result(), { 'A=100', 'B=test' })) | ||
assert.are.same(job:result(), results) | ||
end) | ||
|
||
|
@@ -210,15 +212,7 @@ describe('Job', function() | |
|
||
job:sync() | ||
|
||
local expected = { 'A=100', 'B=test' } | ||
local found = { false, false } | ||
for k, v in ipairs(job:result()) do | ||
for _, w in ipairs(expected) do | ||
if v == w then found[k] = true end | ||
end | ||
end | ||
|
||
assert.are.same({ true, true }, found) | ||
assert.are.same(true, contains(job:result(), { 'A=100', 'B=test' })) | ||
assert.are.same(job:result(), results) | ||
end) | ||
end) | ||
|
@@ -237,11 +231,12 @@ describe('Job', function() | |
end) | ||
|
||
it('should match larger systemlist', function() | ||
local results = vim.fn.systemlist('find') | ||
local results = vim.fn.systemlist('find .') | ||
local stdout_results = {} | ||
|
||
local job = Job:new { | ||
command = 'find', | ||
args = { '.' }, | ||
|
||
on_stdout = function(_, line) table.insert(stdout_results, line) end | ||
} | ||
|
@@ -303,11 +298,11 @@ describe('Job', function() | |
third_job:wait() | ||
fourth_job:wait() | ||
|
||
assert.are.same({'a=1', 'b=2', 'c=3'}, results) | ||
assert.are.same({'a=1'}, first_job:result()) | ||
assert.are.same({'b=2'}, second_job:result()) | ||
assert.are.same(true, contains(results, { 'a=1', 'b=2', 'c=3' })) | ||
assert.are.same(true, contains(first_job:result(), { 'a=1' })) | ||
assert.are.same(true, contains(second_job:result(), { 'b=2' })) | ||
assert.are.same(1, third_job.code) | ||
assert.are.same({'c=3'}, fourth_job:result()) | ||
assert.are.same(true, contains(fourth_job:result(), { 'c=3' })) | ||
end) | ||
|
||
it('should only run the next job on success when using and_then_on_success', function() | ||
|
@@ -341,9 +336,9 @@ describe('Job', function() | |
second_job:wait() | ||
third_job:wait() | ||
|
||
assert.are.same({'a=1', 'b=2'}, results) | ||
assert.are.same({'a=1'}, first_job:result()) | ||
assert.are.same({'b=2'}, second_job:result()) | ||
assert.are.same(true, contains(results, { 'a=1', 'b=2' })) | ||
assert.are.same(true, contains(first_job:result(), { 'a=1' })) | ||
assert.are.same(true, contains(second_job:result(), { 'b=2' })) | ||
assert.are.same(1, third_job.code) | ||
assert.are.same(nil, fourth_job.handle, "Job never started") | ||
end) | ||
|
@@ -375,8 +370,8 @@ describe('Job', function() | |
|
||
assert.are.same(1, first_job.code) | ||
assert.are.same(1, ret) | ||
assert.are.same({'a=1'}, results) | ||
assert.are.same({'a=1'}, second_job:result()) | ||
assert.are.same(true, contains(results, { 'a=1' })) | ||
assert.are.same(true, contains(second_job:result(), { 'a=1' })) | ||
assert.are.same(nil, third_job.handle, "Job never started") | ||
end) | ||
|
||
|
@@ -399,8 +394,8 @@ describe('Job', function() | |
first_job:sync() | ||
second_job:wait() | ||
|
||
assert.are.same({'a=1'}, results) | ||
assert.are.same({'a=1'}, first_job:result()) | ||
assert.are.same(true, contains(results, { 'a=1' })) | ||
assert.are.same(true, contains(first_job:result(), { 'a=1' })) | ||
assert.are.same(1, second_job.code) | ||
assert.are.same(11, code) | ||
end) | ||
|
@@ -426,8 +421,8 @@ describe('Job', function() | |
first_job:sync() | ||
second_job:wait() | ||
|
||
assert.are.same({'a=1'}, results) | ||
assert.are.same({'a=1'}, first_job:result()) | ||
assert.are.same(true, contains(results, { 'a=1' })) | ||
assert.are.same(true, contains(first_job:result(), { 'a=1' })) | ||
assert.are.same(1, second_job.code) | ||
assert.are.same(10, code) | ||
assert.are.same(nil, third_job.handle) | ||
|
@@ -455,8 +450,8 @@ describe('Job', function() | |
local _, ret = first_job:sync() | ||
second_job:wait() | ||
|
||
assert.are.same({'a=1'}, results) | ||
assert.are.same({'a=1'}, second_job:result()) | ||
assert.are.same(true, contains(results, { 'a=1' })) | ||
assert.are.same(true, contains(second_job:result(), { 'a=1' })) | ||
assert.are.same(1, ret) | ||
assert.are.same(1, first_job.code) | ||
assert.are.same(1, code) | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First we need to do that because we fail because of some escape char. So we do that and afterwards we move back to
/