IDEA-87252 (a couple more javadoc tests)

This commit is contained in:
Roman Shevchenko
2015-07-06 18:33:32 +03:00
parent 73f91cf201
commit a9bbf772d6
2 changed files with 39 additions and 24 deletions
@@ -8,7 +8,12 @@ class Foo {
void foo(int i) {}
/**
* {<warning>@linke</warning>}
*/
* {<warning>@linke</warning>}
*/
int field;
/**
* Don't ever think of going here: {<warning>@link/login</warning>}
*/
void m() {}
}
@@ -27,6 +27,16 @@ import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
* @author peter
*/
class JavaDocumentationTest extends LightCodeInsightFixtureTestCase {
private static final String STYLE_BLOCK =
" <style type=\"text/css\">" +
" #error {" +
" background-color: #eeeeee;" +
" margin-bottom: 10px;" +
" }" +
" p {" +
" margin: 5px 0;" +
" }" +
" </style>";
public void testConstructorDoc() {
configure """\
@@ -84,17 +94,7 @@ class JavaDocumentationTest extends LightCodeInsightFixtureTestCase {
def doc = new JavaDocumentationProvider().generateDoc(exprList, null)
def expected =
"<html><head>" +
" <style type=\"text/css\">" +
" #error {" +
" background-color: #eeeeee;" +
" margin-bottom: 10px;" +
" }" +
" p {" +
" margin: 5px 0;" +
" }" +
" </style>" +
"</head><body>" +
"<html><head>" + STYLE_BLOCK + "</head><body>" +
"<small><b><a href=\"psi_element://Foo\"><code>Foo</code></a></b></small>" +
"<PRE>void&nbsp;<b>doFoo</b>()</PRE>" +
"</body></html>"
@@ -163,17 +163,7 @@ class JavaDocumentationTest extends LightCodeInsightFixtureTestCase {
def doc = new JavaDocumentationProvider().generateDoc(method, null)
def expected =
"<html><head>" +
" <style type=\"text/css\">" +
" #error {" +
" background-color: #eeeeee;" +
" margin-bottom: 10px;" +
" }" +
" p {" +
" margin: 5px 0;" +
" }" +
" </style>" +
"</head><body>" +
"<html><head>" + STYLE_BLOCK + "</head><body>" +
"<small><b><a href=\"psi_element://C\"><code>C</code></a></b></small>" +
"<PRE>public&nbsp;void&nbsp;<b>m</b>()</PRE>\n " +
"For example, <a href=\"psi_element://java.lang.String#String(byte[], int, int, java.lang.String)\">" +
@@ -183,6 +173,26 @@ class JavaDocumentationTest extends LightCodeInsightFixtureTestCase {
assert doc == expected
}
public void testInlineTagSpacing() {
configure """\
class C {
/** Visit the "{@code /login}" URL. */
public void <caret>m() { }
}""".stripIndent()
def method = PsiTreeUtil.getParentOfType(myFixture.file.findElementAt(myFixture.editor.caretModel.offset), PsiMethod.class)
def doc = new JavaDocumentationProvider().generateDoc(method, null)
def expected =
"<html><head>" + STYLE_BLOCK + "</head><body>" +
"<small><b><a href=\"psi_element://C\"><code>C</code></a></b></small>" +
"<PRE>public&nbsp;void&nbsp;<b>m</b>()</PRE>" +
" Visit the \"<code>/login</code>\" URL." +
"</body></html>"
assert doc == expected
}
private void configure(String text) {
myFixture.configureByText 'a.java', text
}