forked from eclipse-lemminx/lemminx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for DTD quote enforced formatting
Signed-off-by: David Kwon <[email protected]>
- Loading branch information
1 parent
94b595f
commit 84d2689
Showing
3 changed files
with
77 additions
and
30 deletions.
There are no files selected for viewing
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
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
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 |
---|---|---|
|
@@ -1759,6 +1759,60 @@ public void testUseSingleQuotesMultipleAttributesSplit() throws BadLocationExcep | |
format(content, expected, settings); | ||
} | ||
|
||
@Test | ||
public void testUseSingleQuotesLocalDTD() throws BadLocationException { | ||
SharedSettings settings = new SharedSettings(); | ||
settings.getPreferences().setQuoteStyle(QuoteStyle.singleQuotes); | ||
settings.getFormattingSettings().setEnforceQuoteStyle(EnforceQuoteStyle.preferred); | ||
String content = "<!DOCTYPE note SYSTEM \"note.dtd\">"; | ||
String expected = "<!DOCTYPE note SYSTEM \'note.dtd\'>"; | ||
format(content, expected, settings); | ||
} | ||
|
||
@Test | ||
public void testUseSingleQuotesLocalDTDWithSubset() throws BadLocationException { | ||
SharedSettings settings = new SharedSettings(); | ||
settings.getPreferences().setQuoteStyle(QuoteStyle.singleQuotes); | ||
settings.getFormattingSettings().setEnforceQuoteStyle(EnforceQuoteStyle.preferred); | ||
String content = "<!DOCTYPE article [\n" + // | ||
" <!ENTITY AUTHOR \"John Doe\">\n" + // | ||
" <!ENTITY COMPANY \"JD Power Tools, Inc.\">\n" + // | ||
" <!ENTITY EMAIL \"[email protected]\">\n" + // | ||
" <!ELEMENT E EMPTY>\n" + // | ||
" <!ATTLIST E WIDTH CDATA \"0\">\n" + // | ||
"]>\n" + // | ||
"\n" + // | ||
"<root attr=\"hello\"></root>"; | ||
String expected = "<!DOCTYPE article [\n" + // | ||
" <!ENTITY AUTHOR \'John Doe\'>\n" + // | ||
" <!ENTITY COMPANY \'JD Power Tools, Inc.\'>\n" + // | ||
" <!ENTITY EMAIL \'[email protected]\'>\n" + // | ||
" <!ELEMENT E EMPTY>\n" + // | ||
" <!ATTLIST E WIDTH CDATA \'0\'>\n" + // | ||
"]>\n" + // | ||
"\n" + // | ||
"<root attr=\'hello\'></root>"; | ||
format(content, expected, settings); | ||
} | ||
|
||
@Test | ||
public void testUseSingleQuotesDTDFile() throws BadLocationException { | ||
SharedSettings settings = new SharedSettings(); | ||
settings.getPreferences().setQuoteStyle(QuoteStyle.singleQuotes); | ||
settings.getFormattingSettings().setEnforceQuoteStyle(EnforceQuoteStyle.preferred); | ||
String content = "<!ENTITY AUTHOR \"John Doe\">\n" + // | ||
"<!ENTITY COMPANY \"JD Power Tools, Inc.\">\n" + // | ||
"<!ENTITY EMAIL \"[email protected]\">\n" + // | ||
"<!ELEMENT E EMPTY>\n" + // | ||
"<!ATTLIST E WIDTH CDATA \"0\">"; | ||
String expected = "<!ENTITY AUTHOR \'John Doe\'>\n" + // | ||
"<!ENTITY COMPANY \'JD Power Tools, Inc.\'>\n" + // | ||
"<!ENTITY EMAIL \'[email protected]\'>\n" + // | ||
"<!ELEMENT E EMPTY>\n" + // | ||
"<!ATTLIST E WIDTH CDATA \'0\'>"; | ||
format(content, expected, settings, "test.dtd"); | ||
} | ||
|
||
@Test | ||
public void testDontFormatQuotesByDefault() throws BadLocationException { | ||
SharedSettings settings = new SharedSettings(); | ||
|