-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Write test for catalog extension (see #204)
- Loading branch information
1 parent
f4d6d4a
commit 57cfba0
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
...lsp4xml/src/test/java/org/eclipse/lsp4xml/extensions/catalog/XMLCatalogExtensionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.eclipse.lsp4xml.extensions.catalog; | ||
|
||
import static org.eclipse.lsp4xml.XMLAssert.c; | ||
import static org.eclipse.lsp4xml.XMLAssert.d; | ||
|
||
import org.eclipse.lsp4xml.XMLAssert; | ||
import org.eclipse.lsp4xml.commons.BadLocationException; | ||
import org.eclipse.lsp4xml.extensions.contentmodel.participants.XMLSchemaErrorCode; | ||
import org.junit.Test; | ||
|
||
/** | ||
* Test of catalog completion/validation which doesn't declare DTD or XML | ||
* Schema. | ||
* | ||
*/ | ||
public class XMLCatalogExtensionTest { | ||
|
||
@Test | ||
public void completion() throws BadLocationException { | ||
String xml = "<?xml version=\"1.0\"?>\r\n" + // | ||
"<catalog xmlns=\"urn:oasis:names:tc:entity:xmlns:xml:catalog\">\r\n" + // | ||
" |"; | ||
|
||
XMLAssert.testCompletionFor(xml, 16, c("public", "<public publicId=\"\" uri=\"\" />")); | ||
} | ||
|
||
@Test | ||
public void diagnostics() throws BadLocationException { | ||
String xml = "<?xml version=\"1.0\"?>\r\n" + // | ||
"<catalog xmlns=\"urn:oasis:names:tc:entity:xmlns:xml:catalog\">\r\n" + // | ||
" <bad /> // error validation, because \"bad\" doesn't belong to the XML Schema catalog\r\n" + // | ||
"</catalog> "; | ||
|
||
XMLAssert.testDiagnosticsFor(xml, d(2, 5, 8, XMLSchemaErrorCode.cvc_complex_type_2_4_a), // | ||
d(2, 12, 14, XMLSchemaErrorCode.cvc_complex_type_2_3)); | ||
} | ||
} |