FollowsReferenceBlockParser parser = new FollowsReferenceBlockParser();
DefaultJavadocScanner scanner = string("#field");
IrDocBlock block = parser.parse(null, scanner);
List<? extends IrDocFragment> fragments = block.getFragments();
assertKinds(fragments, FIELD);
IrDocField field = (IrDocField) fragments.get(0);
assertNull(field.getDeclaringType());
assertEquals("field", field.getName().getIdentifier());
}
{
FollowsReferenceBlockParser parser = new FollowsReferenceBlockParser();
DefaultJavadocScanner scanner = string("A#field");
IrDocBlock block = parser.parse(null, scanner);
List<? extends IrDocFragment> fragments = block.getFragments();
assertKinds(fragments, FIELD);
IrDocField field = (IrDocField) fragments.get(0);
assertEquals("A", field.getDeclaringType().getName().asString());
assertEquals("field", field.getName().getIdentifier());
}
{
FollowsReferenceBlockParser parser = new FollowsReferenceBlockParser();
DefaultJavadocScanner scanner = string("hoge.foo.Bar#CONST");
IrDocBlock block = parser.parse(null, scanner);
List<? extends IrDocFragment> fragments = block.getFragments();
assertKinds(fragments, FIELD);
IrDocField field = (IrDocField) fragments.get(0);
assertEquals("hoge.foo.Bar", field.getDeclaringType().getName().asString());
assertEquals("CONST", field.getName().getIdentifier());
}
{
FollowsReferenceBlockParser parser = new FollowsReferenceBlockParser();
DefaultJavadocScanner scanner = string("\n * hoge.foo.Bar#CONST");
IrDocBlock block = parser.parse(null, scanner);
List<? extends IrDocFragment> fragments = block.getFragments();
assertKinds(fragments, FIELD);
IrDocField field = (IrDocField) fragments.get(0);
assertEquals("hoge.foo.Bar", field.getDeclaringType().getName().asString());
assertEquals("CONST", field.getName().getIdentifier());
}
}