Skip to content

Fix REPL test result uniqueness #32446

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stdlib/REPL/test/replcompletions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ end

function map_completion_text(completions)
c, r, res = completions
return map(completion_text, c), r, res
return unique!(map(completion_text, c)), r, res
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think one of the intents of this test is to make sure that the completions aren't returning non-unique duplicates

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The completions can have duplicates which is why we call unique! on it in the REPL code itself, #28692, #28694.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, and this is the test you added in #28694 to check that the list does not have duplicates

Copy link
Member

@KristofferC KristofferC Jun 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test added there assumes that test_completion does the same as complete_line. However, right now, only complete_line does the unique! call. So the test is at least faulty with the current map_completion_text.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I can see that with this change, the count( ...) == 1 part is obsolete.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is right. The way things are written now, it is a bit hard to test this properly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think one of the intents of this test is to make sure that the completions aren't returning non-unique duplicates

Why would that be a problem ?

end

test_complete(s) = map_completion_text(completions(s,lastindex(s)))
Expand Down