From 7429cc8819d2c8a9e176d62a6b207933c92394c8 Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Fri, 7 Feb 2014 15:08:57 -0800 Subject: [PATCH] Make JetTestUtils.getLastCommentInFile() to allow trailing newline Many editors add a trailing newline when saving. Allow them in getLastCommentInFile. --- compiler/tests/org/jetbrains/jet/JetTestUtils.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler/tests/org/jetbrains/jet/JetTestUtils.java b/compiler/tests/org/jetbrains/jet/JetTestUtils.java index 414505f58a7..e74f34966ab 100644 --- a/compiler/tests/org/jetbrains/jet/JetTestUtils.java +++ b/compiler/tests/org/jetbrains/jet/JetTestUtils.java @@ -531,6 +531,9 @@ public class JetTestUtils { public static String getLastCommentInFile(JetFile file) { PsiElement lastChild = file.getLastChild(); + if (lastChild != null && lastChild.getNode().getElementType().equals(JetTokens.WHITE_SPACE)) { + lastChild = lastChild.getPrevSibling(); + } assert lastChild != null; if (lastChild.getNode().getElementType().equals(JetTokens.BLOCK_COMMENT)) {