use of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegionList in project webtools.sourceediting by eclipse.
the class ScannerUnitTests method testJSPCommentInXMLComment.
public void testJSPCommentInXMLComment() {
String text = "s<!--\n<%--c--%>\n-->\n<html>\n<body><script> <%--c--%> </script>\n";
IStructuredDocumentRegionList nodes = setUpJSP(text);
boolean sizeCheck = checkSimpleRegionCounts(nodes, new int[] { 1, 5, 1, 3, 1, 3, 3, 3, 3, 1 });
assertTrue("IStructuredDocumentRegion and ITextRegion count", sizeCheck);
int item = 0;
boolean typeCheck = checkSimpleRegionTypes(nodes.item(item++).getRegions(), new String[] { DOMRegionContext.XML_CONTENT }) && checkComplexRegionTypes(nodes.item(item++).getRegions(), new String[] { DOMRegionContext.XML_COMMENT_OPEN, DOMRegionContext.XML_COMMENT_TEXT, DOMRegionContext.XML_COMMENT_TEXT, DOMRegionContext.XML_COMMENT_TEXT, DOMRegionContext.XML_COMMENT_CLOSE }, new String[][] { { DOMJSPRegionContexts.JSP_COMMENT_OPEN, DOMJSPRegionContexts.JSP_COMMENT_TEXT, DOMJSPRegionContexts.JSP_COMMENT_CLOSE } }) && checkSimpleRegionTypes(nodes.item(item++).getRegions(), new String[] { DOMRegionContext.XML_CONTENT }) && checkSimpleRegionTypes(nodes.item(item++).getRegions(), new String[] { DOMRegionContext.XML_TAG_OPEN, DOMRegionContext.XML_TAG_NAME, DOMRegionContext.XML_TAG_CLOSE }) && checkSimpleRegionTypes(nodes.item(item++).getRegions(), new String[] { DOMRegionContext.XML_CONTENT }) && checkSimpleRegionTypes(nodes.item(item++).getRegions(), new String[] { DOMRegionContext.XML_TAG_OPEN, DOMRegionContext.XML_TAG_NAME, DOMRegionContext.XML_TAG_CLOSE }) && checkSimpleRegionTypes(nodes.item(item++).getRegions(), new String[] { DOMRegionContext.XML_TAG_OPEN, DOMRegionContext.XML_TAG_NAME, DOMRegionContext.XML_TAG_CLOSE }) && checkComplexRegionTypes(nodes.item(item++).getRegions(), new String[] { DOMRegionContext.BLOCK_TEXT, DOMRegionContext.BLOCK_TEXT, DOMRegionContext.BLOCK_TEXT }, new String[][] { { DOMJSPRegionContexts.JSP_COMMENT_OPEN, DOMJSPRegionContexts.JSP_COMMENT_TEXT, DOMJSPRegionContexts.JSP_COMMENT_CLOSE } }) && checkSimpleRegionTypes(nodes.item(item++).getRegions(), new String[] { DOMRegionContext.XML_END_TAG_OPEN, DOMRegionContext.XML_TAG_NAME, DOMRegionContext.XML_TAG_CLOSE }) && checkSimpleRegionTypes(nodes.item(9).getRegions(), new String[] { DOMRegionContext.XML_CONTENT });
assertTrue("region context type check", typeCheck);
verifyLengths(0, nodes.item(0), text);
}
use of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegionList in project webtools.sourceediting by eclipse.
the class ScannerUnitTests method testJSP_DHTMLimport.
public void testJSP_DHTMLimport() {
String text = "<a> <?import type=\"foo\">";
IStructuredDocumentRegionList nodes = setUpJSP(text);
boolean sizeCheck = checkSimpleRegionCounts(nodes, new int[] { 3, 1, 6 });
assertTrue("IStructuredDocumentRegion and ITextRegion count", sizeCheck);
boolean typeCheck = checkSimpleRegionTypes(nodes.item(0).getRegions(), new String[] { DOMRegionContext.XML_TAG_OPEN, DOMRegionContext.XML_TAG_NAME, DOMRegionContext.XML_TAG_CLOSE });
assertTrue("region context type check", typeCheck);
typeCheck = checkSimpleRegionTypes(nodes.item(1).getRegions(), new String[] { DOMRegionContext.XML_CONTENT });
assertTrue("region context type check", typeCheck);
typeCheck = checkSimpleRegionTypes(nodes.item(2).getRegions(), new String[] { DOMRegionContext.XML_PI_OPEN, DOMRegionContext.XML_TAG_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_EQUALS, DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE, DOMRegionContext.XML_PI_CLOSE });
assertTrue("region context type check", typeCheck);
verifyLengths(0, nodes, text);
}
use of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegionList in project webtools.sourceediting by eclipse.
the class ScannerUnitTests method testJSPTagInAttValue.
public void testJSPTagInAttValue() {
String text = "<a type=\"<a/>\"/>";
IStructuredDocumentRegionList nodes = setUpJSP(text);
boolean sizeCheck = checkSimpleRegionCounts(nodes, new int[] { 6 });
assertTrue("IStructuredDocumentRegion and ITextRegion count", sizeCheck);
sizeCheck = checkSimpleRegionCount(((ITextRegionContainer) nodes.item(0).getRegions().get(4)), 5);
assertTrue("IStructuredDocumentRegion and ITextRegion count", sizeCheck);
boolean typeCheck = checkSimpleRegionTypes(nodes.item(0).getRegions(), new String[] { DOMRegionContext.XML_TAG_OPEN, DOMRegionContext.XML_TAG_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_EQUALS, DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE, DOMRegionContext.XML_EMPTY_TAG_CLOSE });
assertTrue("region context type check (tag)", typeCheck);
typeCheck = checkSimpleRegionTypes(((ITextRegionContainer) nodes.item(0).getRegions().get(4)).getRegions(), new String[] { DOMJSPRegionContexts.XML_TAG_ATTRIBUTE_VALUE_DQUOTE, DOMRegionContext.XML_TAG_OPEN, DOMRegionContext.XML_TAG_NAME, DOMRegionContext.XML_EMPTY_TAG_CLOSE, DOMJSPRegionContexts.XML_TAG_ATTRIBUTE_VALUE_DQUOTE });
assertTrue("region context type check (att value)", typeCheck);
verifyLengths(0, nodes, text);
}
use of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegionList in project webtools.sourceediting by eclipse.
the class ScannerUnitTests method testUndefinedRegionContainer.
public void testUndefinedRegionContainer() {
// see RATLC RATLC00284776
String text = "<option <elms:inputValue value=\"<%=uomvox.uomID%>\"/><%=uomvox.uomID.equals(uomID) ? \" selected\" : \"\"%>>";
IStructuredDocumentRegionList nodes = setUpJSP(text);
boolean sizeCheck = checkSimpleRegionCounts(nodes, new int[] { 5 });
assertTrue("IStructuredDocumentRegion and overall ITextRegion count", sizeCheck);
// checkComplexRegionTypes(nodes.item(0).getRegions(), new
// String[]{XMLRegionContext.XML_TAG_OPEN,
// XMLRegionContext.XML_TAG_NAME,
// XMLRegionContext.XML_TAG_ATTRIBUTE_NAME,
// XMLRegionContext.UNDEFINED, XMLRegionContext.XML_TAG_CLOSE}, new
// String[][] {{}});
verifyEmbeddedContainerParentage(nodes);
verifyLengths(0, nodes.item(0), text);
}
use of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegionList in project webtools.sourceediting by eclipse.
the class ScannerUnitTests method testJSPLessThanInAttValue.
public void testJSPLessThanInAttValue() {
// bails out of the attribute value with an UNDEFINED region for the
// end quote
String text = "<button label=\"<previous\"/>";
IStructuredDocumentRegionList nodes = setUpJSP(text);
boolean sizeCheck = checkSimpleRegionCounts(nodes, new int[] { 6 });
assertTrue("IStructuredDocumentRegion and ITextRegion count", sizeCheck);
// sizeCheck = checkSimpleRegionCount(((ITextRegionContainer) nodes.item(0).getRegions().get(4)), 4);
// assertTrue("IStructuredDocumentRegion and ITextRegion count (att value)", sizeCheck);
boolean typeCheck = checkSimpleRegionTypes(nodes.item(0).getRegions(), new String[] { DOMRegionContext.XML_TAG_OPEN, DOMRegionContext.XML_TAG_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_EQUALS, DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE, DOMRegionContext.XML_EMPTY_TAG_CLOSE });
assertTrue("region context type check", typeCheck);
// typeCheck = checkSimpleRegionTypes(((ITextRegionContainer) nodes.item(0).getRegions().get(4)).getRegions(), new String[]{DOMJSPRegionContexts.XML_TAG_ATTRIBUTE_VALUE_DQUOTE, DOMRegionContext.XML_TAG_OPEN, DOMRegionContext.XML_TAG_NAME, DOMRegionContext.UNDEFINED});
// assertTrue("region context type check (att value)", typeCheck);
verifyLengths(0, nodes.item(0), text);
}
Aggregations