Skip to content

Commit

Permalink
Fix, add tests
Browse files Browse the repository at this point in the history
Signed-off-by: Omar Farag <[email protected]>
  • Loading branch information
o-farag committed Sep 5, 2023
1 parent f36c3fc commit 5782e0c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public void disableXMLSchemaValidationFilter() throws Exception {
// test.xsd doesn't matches the validation filter
XMLAssert.testPublishDiagnosticsFor(xml, fileURI, validation, ls, pd(fileURI, //
// XML schema error code
new Diagnostic(r(2, 15, 2, 15),
new Diagnostic(r(2, 7, 2, 14),
"src-annotation: <annotation> elements can only contain <appinfo> and <documentation> elements, but 'appInfo' was found.",
DiagnosticSeverity.Error, "xsd", XSDErrorCode.src_annotation.getCode())));

Expand Down Expand Up @@ -173,7 +173,7 @@ public void defaultDisableXMLSchemaValidationFilter() throws Exception {
// test.xsd doesn't matches the validation filter
XMLAssert.testPublishDiagnosticsFor(xml, fileURI, validation, ls, pd(fileURI, //
// XML schema error code
new Diagnostic(r(2, 15, 2, 15),
new Diagnostic(r(2, 7, 2, 14),
"src-annotation: <annotation> elements can only contain <appinfo> and <documentation> elements, but 'appInfo' was found.",
DiagnosticSeverity.Error, "xsd", XSDErrorCode.src_annotation.getCode())));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,28 @@ public void s4s_elt_invalid_content_3WithSelfClosingTag() throws BadLocationExce
testCodeActionsFor(xml, d, ca(d, te(2, 1, 2, 13, "")));
}

@Test
public void src_annotation_invalid_tag_() throws BadLocationException {
String xml = "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\r\n" + //
" <xs:annotation>\r\n" + //
" <xs:appInfo>\r\n" + //
" </xs:appInfo>\r\n" + //
" </xs:annotation>\r\n" + //
"</xs:schema>";
Diagnostic d = d(2, 9, 2, 19, XSDErrorCode.src_annotation);
testDiagnosticsFor(xml, d);
testCodeActionsFor(xml, d,
ca(d,
te(2, 9, 2, 19, "xs:appinfo"),
te(3, 10, 3, 20,"xs:appinfo")
),
ca(d,
te(2, 9, 2, 19, "xs:documentation"),
te(3, 10, 3, 20,"xs:documentation")
)
);
}

@Test
public void sch_props_correct_2() throws BadLocationException {
String xml = "<?xml version=\"1.1\" ?>\r\n" + //
Expand Down

0 comments on commit 5782e0c

Please sign in to comment.