Skip to content

Commit

Permalink
added test with no end tag
Browse files Browse the repository at this point in the history
  • Loading branch information
JessicaJHee authored and angelozerr committed Jun 14, 2022
1 parent 6284279 commit 85a2e05
Showing 1 changed file with 16 additions and 0 deletions.
Expand Up @@ -19,6 +19,8 @@
import org.eclipse.lemminx.XMLAssert;
import org.eclipse.lemminx.extensions.contentmodel.participants.DTDErrorCode;
import org.eclipse.lemminx.extensions.contentmodel.participants.XMLSchemaErrorCode;
import org.eclipse.lemminx.extensions.contentmodel.participants.XMLSyntaxErrorCode;

import org.eclipse.lsp4j.Diagnostic;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -113,7 +115,21 @@ public void cvc_elt_1_a_multiple_roots_defined() throws Exception {
te(5, 2, 5, 6, "root2")));
}

@Test
public void cvc_elt_1_a_no_end_tag() throws Exception {
String xml = "<test xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\r\n" + //
" xsi:noNamespaceSchemaLocation=\"src/test/resources/xsd/unique.xsd\">\r\n" + //
" <authors status = \"new\">\r\n" + //
" <author>smith</author>\r\n" + //
" </authors>\r\n";
Diagnostic d1 = d(0, 1, 0, 5, XMLSchemaErrorCode.cvc_elt_1_a);
Diagnostic d2 = d(0, 1, 0, 5,XMLSyntaxErrorCode.MarkupEntityMismatch);
testDiagnosticsFor(xml, d1, d2);
testCodeActionsFor(xml, d1, ca(d1, te(0, 1, 0, 5, "root")));
}

private static void testDiagnosticsFor(String xml, Diagnostic... expected) {
XMLAssert.testDiagnosticsFor(xml, "src/test/resources/catalogs/catalog.xml", expected);
}

}

0 comments on commit 85a2e05

Please sign in to comment.