Skip to content
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

add some more tests, fix terminal completion bug #234696

Merged
merged 14 commits into from
Nov 27, 2024

Conversation

meganrogge
Copy link
Contributor

@meganrogge meganrogge commented Nov 26, 2024

This moves the rest of the code that deals with completions into the function that we're testing, so now truly represents what's being returned.

Added tests cases for the bug and made the fixes so that they now pass.

fix #234667

@meganrogge meganrogge assigned meganrogge and unassigned meganrogge Nov 26, 2024
@meganrogge meganrogge added this to the November 2024 milestone Nov 26, 2024
@meganrogge meganrogge enabled auto-merge (squash) November 26, 2024 19:17
@meganrogge meganrogge enabled auto-merge (squash) November 26, 2024 20:18
Comment on lines 18 to +21
const testSpecs: ITestSpec[] = [
{ input: '|', expectedCompletionLabels: availableCommands },
{ input: 'c|', expectedCompletionLabels: availableCommands },
{ input: 'ls && c|', expectedCompletionLabels: availableCommands },
{ input: '|', expectedCompletionLabels: availableCommands, resourcesRequested: 'both' },
{ input: 'c|', expectedCompletionLabels: availableCommands.filter(c => c.startsWith('c')) },
{ input: 'ls && c|', expectedCompletionLabels: availableCommands.filter(c => c.startsWith('c')) },
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 you'll want to isolate the tests a little more or they'll just get more complicated over time. So instead of having all tests use all completions, have most unit tests focus on specific completion specs, then a small amount that deal with merging and dealing with all of them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

makes sense, have just been fixing bugs for now. seems like something to defer.

Copy link
Member

Choose a reason for hiding this comment

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

This was that ITestSpec2 interface we wrote up together 👍

Copy link
Member

Choose a reason for hiding this comment

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

extensions/terminal-suggest/src/terminalSuggestMain.ts Outdated Show resolved Hide resolved
Comment on lines 18 to +21
const testSpecs: ITestSpec[] = [
{ input: '|', expectedCompletionLabels: availableCommands },
{ input: 'c|', expectedCompletionLabels: availableCommands },
{ input: 'ls && c|', expectedCompletionLabels: availableCommands },
{ input: '|', expectedCompletionLabels: availableCommands, resourcesRequested: 'both' },
{ input: 'c|', expectedCompletionLabels: availableCommands.filter(c => c.startsWith('c')) },
{ input: 'ls && c|', expectedCompletionLabels: availableCommands.filter(c => c.startsWith('c')) },
Copy link
Member

Choose a reason for hiding this comment

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

@meganrogge meganrogge merged commit bd95301 into main Nov 27, 2024
8 checks passed
@meganrogge meganrogge deleted the merogge/fix-bug-add-tests branch November 27, 2024 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Terminal suggest: Several unknown completions for "cd ." in pwsh
2 participants