-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 tests and fix some exceptions during the tests #914
Changes from all commits
a0784a2
7b11523
bde1cfa
2c973ca
fe252db
2978145
47fb36f
a1364a7
79dcdb9
278662c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,18 @@ suite("Mode Insert", () => { | |
assertEqual(TextEditor.getSelection().start.character, 4, "<Esc> moved cursor position."); | ||
}); | ||
|
||
test("", async () => { | ||
test("<C-c> can exit insert", async () => { | ||
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. Wait, don't we need some special config for this? 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. What do you mean? 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. I think it's 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. We have C-xxxx keys all throughout our tests though |
||
await modeHandler.handleMultipleKeyEvents([ | ||
'i', | ||
't', 'e', 'x', 't', | ||
'<C-c>', | ||
'o' | ||
]); | ||
|
||
return assertEqualLines(["text", ""]); | ||
}); | ||
|
||
test("<Esc> can exit insert", async () => { | ||
await modeHandler.handleMultipleKeyEvents([ | ||
'i', | ||
't', 'e', 'x', 't', | ||
|
@@ -54,6 +65,14 @@ suite("Mode Insert", () => { | |
return assertEqualLines(["text", ""]); | ||
}); | ||
|
||
test("Stay in insert when entering characters", async () => { | ||
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. I don't think this will ever catch the elusive bug unfortunately. It's triggered when there are multiple vimStates for the same file. That's almost impossible to cause in a test. 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. Hmm.. A better test might be to switch the language to HTML or something and then ensure that there was only ever one mode handler created. |
||
await modeHandler.handleKeyEvent('i'); | ||
for (var i = 0; i < 10; i++) { | ||
await modeHandler.handleKeyEvent('1'); | ||
assertEqual(modeHandler.currentMode.name === ModeName.Insert, true); | ||
} | ||
}); | ||
|
||
test("Can handle 'O'", async () => { | ||
await modeHandler.handleMultipleKeyEvents([ | ||
'i', | ||
|
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.
I don't like the duplication here. Ideally we don't even check for this case, it's just handled upstream in ModeHandler.
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.
by the way, these tests that I was trying to fix with these lines dont throw exceptions on macOS but they do on windows...