-
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.
Merge pull request pmd#4592 from Monits:xml-declaration
[xml] Add MissingEncoding rule pmd#4592
- Loading branch information
Showing
11 changed files
with
145 additions
and
4 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
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
11 changes: 11 additions & 0 deletions
11
...ml/src/test/java/net/sourceforge/pmd/lang/xml/rule/bestpractices/MissingEncodingTest.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,11 @@ | ||
/** | ||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html | ||
*/ | ||
|
||
package net.sourceforge.pmd.lang.xml.rule.bestpractices; | ||
|
||
import net.sourceforge.pmd.testframework.PmdRuleTst; | ||
|
||
class MissingEncodingTest extends PmdRuleTst { | ||
// no additional unit tests | ||
} |
2 changes: 1 addition & 1 deletion
2
pmd-xml/src/test/resources/net/sourceforge/pmd/lang/xml/ast/testdata/bug1518.txt
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
2 changes: 1 addition & 1 deletion
2
pmd-xml/src/test/resources/net/sourceforge/pmd/lang/xml/ast/testdata/sampleNs.txt
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
2 changes: 1 addition & 1 deletion
2
pmd-xml/src/test/resources/net/sourceforge/pmd/lang/xml/ast/testdata/sampleXml.txt
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
60 changes: 60 additions & 0 deletions
60
...rc/test/resources/net/sourceforge/pmd/lang/xml/rule/bestpractices/xml/MissingEncoding.xml
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,60 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<test-data | ||
xmlns="http://pmd.sourceforge.net/rule-tests" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://pmd.sourceforge.net/rule-tests http://pmd.sourceforge.net/rule-tests_1_0_0.xsd"> | ||
|
||
<test-code> | ||
<description>No XML Declaration</description> | ||
<expected-problems>1</expected-problems> | ||
<code><![CDATA[ | ||
<root> | ||
<child/> | ||
</root> | ||
]]></code> | ||
</test-code> | ||
|
||
<test-code> | ||
<description>XML Declaration without encoding</description> | ||
<expected-problems>1</expected-problems> | ||
<code><![CDATA[ | ||
<?xml version="1.0" ?> | ||
<root> | ||
<child/> | ||
</root> | ||
]]></code> | ||
</test-code> | ||
|
||
<test-code> | ||
<description>XML Declaration with UTF-8 encoding</description> | ||
<expected-problems>0</expected-problems> | ||
<code><![CDATA[ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<root> | ||
<child/> | ||
</root> | ||
]]></code> | ||
</test-code> | ||
|
||
<test-code> | ||
<description>XML Declaration with ISO-8859-1 encoding</description> | ||
<expected-problems>0</expected-problems> | ||
<code><![CDATA[ | ||
<?xml version="1.0" encoding="ISO-8859-1" ?> | ||
<root> | ||
<child/> | ||
</root> | ||
]]></code> | ||
</test-code> | ||
|
||
<test-code> | ||
<description>XML Declaration with UTF-8 encoding and standalone</description> | ||
<expected-problems>0</expected-problems> | ||
<code><![CDATA[ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> | ||
<root> | ||
<child/> | ||
</root> | ||
]]></code> | ||
</test-code> | ||
</test-data> |