mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-140025 support pre-Java8 javadoc logic if corresponding JDK is used
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><PRE>class <b>Test</b>
|
||||
extends <a href="psi_element://java.lang.Object"><code>Object</code></a></PRE> <pre>abc</pre></body></html>
|
||||
@@ -0,0 +1,2 @@
|
||||
/** <pre>a{@literal b}c</pre> */
|
||||
class Test {}
|
||||
@@ -1,2 +1,2 @@
|
||||
<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://Foo"><code>Foo</code></a></b></small><PRE>int <b>foo</b></PRE>
|
||||
foo <></body></html>
|
||||
foo<></body></html>
|
||||
@@ -1,3 +1,3 @@
|
||||
<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><PRE>class <b>Test</b>
|
||||
extends <a href="psi_element://java.lang.Object"><code>Object</code></a></PRE>
|
||||
a@b c@d</body></html>
|
||||
a@b c@d</body></html>
|
||||
+26
@@ -18,11 +18,13 @@ package com.intellij.codeInsight.javadoc;
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.codeInsight.CodeInsightTestCase;
|
||||
import com.intellij.lang.java.JavaDocumentationProvider;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
|
||||
import java.io.File;
|
||||
@@ -32,6 +34,8 @@ import java.io.IOException;
|
||||
* @author yole
|
||||
*/
|
||||
public class JavaDocInfoGeneratorTest extends CodeInsightTestCase {
|
||||
private boolean myUseJava8Sdk;
|
||||
|
||||
public void testSimpleField() throws Exception {
|
||||
doTestField();
|
||||
}
|
||||
@@ -127,6 +131,7 @@ public class JavaDocInfoGeneratorTest extends CodeInsightTestCase {
|
||||
}
|
||||
|
||||
public void testCode() throws Exception {
|
||||
useJava8();
|
||||
doTestField();
|
||||
}
|
||||
|
||||
@@ -260,6 +265,12 @@ public class JavaDocInfoGeneratorTest extends CodeInsightTestCase {
|
||||
}
|
||||
|
||||
public void testMultipleSpacesInLiteral() throws Exception {
|
||||
useJava8();
|
||||
verifyJavaDoc(getTestClass());
|
||||
}
|
||||
|
||||
public void testLegacySpacesInLiteral() throws Exception {
|
||||
useJava7();
|
||||
verifyJavaDoc(getTestClass());
|
||||
}
|
||||
|
||||
@@ -267,7 +278,22 @@ public class JavaDocInfoGeneratorTest extends CodeInsightTestCase {
|
||||
protected String getTestDataPath() {
|
||||
return JavaTestUtil.getJavaTestDataPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Sdk getTestProjectJdk() {
|
||||
return myUseJava8Sdk ? IdeaTestUtil.getMockJdk18() : IdeaTestUtil.getMockJdk17();
|
||||
}
|
||||
|
||||
private void useJava8() {
|
||||
myUseJava8Sdk = true;
|
||||
setUpJdk();
|
||||
}
|
||||
|
||||
private void useJava7() {
|
||||
myUseJava8Sdk = false;
|
||||
setUpJdk();
|
||||
}
|
||||
|
||||
private static String replaceEnvironmentDependentContent(String html) {
|
||||
return StringUtil.convertLineSeparators(html.trim()).replaceAll("<base href=\"[^\"]*\">", "<base href=\"placeholder\">");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user