Skip to content

Commit

Permalink
Fix test related to surround with try..except.
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioz committed Sep 14, 2024
1 parent 3995fa6 commit 000b447
Showing 1 changed file with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import java.util.List;

import org.eclipse.core.runtime.AssertionFailedException;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IAutoIndentStrategy;
import org.eclipse.jface.text.IDocument;
Expand Down Expand Up @@ -89,7 +90,7 @@ public void testSurround2() throws Exception {
" #c\n" +
" a = 10\n"
+
" except:\n" +
" except Exception:\n" +
" raise\n" +
"\n" +
"\n" +
Expand All @@ -98,7 +99,13 @@ public void testSurround2() throws Exception {

private void apply(ICompletionProposalHandle iCompletionProposalHandle, IDocument doc) {
TemplateProposal p = (TemplateProposal) iCompletionProposalHandle;
p.apply(createViewerWithDoc(doc), ' ', 0, 0);
try {
p.apply(createViewerWithDoc(doc), ' ', 0, 0);
} catch (AssertionFailedException e) {
// Ignore (we have errors linking with the UI because it's not there and
// TemplateProposal isn't smart enough to work without it, but it can at least
// do the replacement before failing).
}
}

public void testSurround3() throws Exception {
Expand All @@ -121,7 +128,7 @@ public void testSurround3() throws Exception {
" #c\n" +
" # a = 10\n"
+
"except:\n" +
"except Exception:\n" +
" raise\n" +
"\n" +
"\n" +
Expand All @@ -138,7 +145,7 @@ public void testSurround() throws Exception {
TestCaseUtils.assertContentsEqual("" +
"try:\n" +
" a = 10\n" +
"except:\n" +
"except Exception:\n" +
" raise" +
"",
doc.get());
Expand All @@ -158,7 +165,7 @@ public void testSurround() throws Exception {
+ " \n"
+ " \n"
+ " a = 10\n"
+ " except:\n"
+ " except Exception:\n"
+ " raise",
additionalProposalInfo);

Expand All @@ -171,7 +178,7 @@ public void testSurround() throws Exception {
" \n" +
" a = 10\n"
+
" except:\n" +
" except Exception:\n" +
" raise\n" +
"\n" +
"\n" +
Expand Down

0 comments on commit 000b447

Please sign in to comment.