Skip to content

Commit

Permalink
Fixed Ignored test cases
Browse files Browse the repository at this point in the history
Fixes eclipse-lemminx#319

Signed-off-by: Nikolas <[email protected]>
  • Loading branch information
NikolasKomonen authored and fbricon committed Mar 18, 2019
1 parent 3988871 commit afdfd18
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ public static Range selectChildEndTag(String childTag, int offset, DOMDocument d
if (child != null) {
return createRange(child.getStart() + 1, child.getStart() + 1 + childTag.length(), document);
}
if(parent.isElement()) {
String parentName = ((DOMElement) parent).getTagName();
return createRange(parent.getStart() + 2, parent.getStart() + 2 + parentName.length(), document);
}
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,33 +333,6 @@ public void attListDeclNotClosed() {
Assert.assertTrue(actual.getChild(1).isElement());
}

//This will fail because the Attribute name regex in Constants.java considers the ']' after 'a' a valid attribute name
@Ignore
@Test
public void attListDeclWithNameNotClosed() {
String xml = "<!DOCTYPE foo [<!ATTLIST a]><foo/>";

DOMDocument actual = createDOMDocument(xml);
Assert.assertEquals(2, actual.getChildren().size());
Assert.assertTrue(actual.getChild(0).isDoctype());
DOMDocumentType documentType = (DOMDocumentType) actual.getChild(0);
Assert.assertEquals(0, documentType.getStart());
Assert.assertEquals(28, documentType.getEnd());
Assert.assertEquals("foo", documentType.getName());
Assert.assertTrue(documentType.isClosed());

// <!ATTLIST
Assert.assertEquals(1, documentType.getChildren().size());
Assert.assertTrue(documentType.getChild(0).isDTDAttListDecl());
DTDAttlistDecl attListDecl = (DTDAttlistDecl) documentType.getChild(0);
Assert.assertEquals(15, attListDecl.getStart());
Assert.assertEquals(25, attListDecl.getEnd());
Assert.assertFalse(attListDecl.isClosed());

// <foo />element
Assert.assertTrue(actual.getChild(1).isElement());
}

@Test
public void attListDeclClosed() {
String xml = "<!DOCTYPE foo [<!ATTLIST >]><foo/>";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ public void completionInChildElement() throws BadLocationException {
}

@Test
@Ignore
public void completionInChildElementNoOpenBracket() throws BadLocationException {
String xml = "<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\r\n" + //
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\r\n" + //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,6 @@ public void testEmptyPrefixedAttName() throws Exception {
testDiagnosticsFor(xml, d(0, 20, 0, 22, XMLSyntaxErrorCode.EmptyPrefixedAttName));
}

@Ignore
@Test
public void testEncodingDeclRequired() throws Exception {
String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" lang=\"en\" ?><a></a>";
testDiagnosticsFor(xml, d(0, 20, 0, 22, XMLSyntaxErrorCode.EncodingDeclRequired));
}

@Test
public void testEqRequiredInAttribute() throws Exception {
String xml = "<a Ccy>123.456</a>";
Expand All @@ -143,11 +136,10 @@ public void testEqRequiredInAttribute() throws Exception {
testCodeActionsFor(xml, d, ca(d, te(0, 6, 0, 6, "=\"\"")));
}

@Ignore("This test works on OS Windows but fails in travis, why? ")
@Test
public void testEqRequiredInXMLDecl() throws Exception {
String xml = "<?xml version:\"1.0\" encoding=\"UTF-8\"?><a></a>";
testDiagnosticsFor(xml, d(0, 14, 0, 14, XMLSyntaxErrorCode.EqRequiredInXMLDecl));
testDiagnosticsFor(xml, d(0, 6, 0, 14, XMLSyntaxErrorCode.EqRequiredInXMLDecl));
}

/**
Expand All @@ -157,24 +149,20 @@ public void testEqRequiredInXMLDecl() throws Exception {
* Exception
*/
@Test
@Ignore
public void testETagRequired() throws Exception {
String xml = "<UltmtDbtr>\r\n" + //
" <Nm>Name\r\n" + //
" </UltmtDbtr> \r\n" + //
" </Nm> ";
testDiagnosticsFor(xml, d(1, 5, 1, 7, XMLSyntaxErrorCode.ETagRequired),
d(2, 4, 2, 13, XMLSyntaxErrorCode.ETagRequired));
testDiagnosticsFor(xml, d(1, 5, 1, 7, XMLSyntaxErrorCode.ETagRequired));
}

@Test
@Ignore // Nm is not created properly
public void testETagRequired2() throws Exception {
String xml = "<UltmtDbtr>\r\n" + //
" Nm>Name</Nm>\r\n" + //
" </UltmtDbtr>";
testDiagnosticsFor(xml, d(0, 1, 0, 10, XMLSyntaxErrorCode.ETagRequired),
d(2, 4, 2, 13, XMLSyntaxErrorCode.ETagRequired));
testDiagnosticsFor(xml, d(1, 13, 1, 15, XMLSyntaxErrorCode.ETagRequired));
}

/**
Expand Down Expand Up @@ -312,17 +300,6 @@ public void testMissingQuotesForAttribute() throws Exception {
testDiagnosticsFor(xml, d(2, 7, 2, 10, XMLSyntaxErrorCode.OpenQuoteExpected));
}

/**
* @see https://wiki.xmldation.com/Support/Validator/the-element-type-lmsg
* @throws Exception
*/
@Ignore
@Test
public void testTheElementTypeLmsg() throws Exception {
String xml = "<Issr>ADE</Lssr>";
testDiagnosticsFor(xml, d(0, 20, 0, 22, XMLSyntaxErrorCode.the_element_type_lmsg));
}

@Test
public void testVersionInfoRequired() throws Exception {
String xml = "<?xml encoding=\"UTF-8\"?>";
Expand All @@ -334,12 +311,4 @@ public void testVersionNotSupported() throws Exception {
String xml = "<?xml version=\"5000.0\"encoding=\"UTF-8\"?>";
testDiagnosticsFor(xml, d(0, 14, 0, 22, XMLSyntaxErrorCode.VersionNotSupported));
}

@Ignore
@Test
public void testXMLDeclUnterminated() throws Exception {
String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?";
testDiagnosticsFor(xml, d(0, 37, 0, 37, XMLSyntaxErrorCode.XMLDeclUnterminated));
}

}

0 comments on commit afdfd18

Please sign in to comment.