<?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>ok use of octal</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
    void bar() {
        String x = "\027";
    }
}
        ]]></code>
    </test-code>

    <test-code>
        <description>should be flagged</description>
        <expected-problems>1</expected-problems>
        <expected-linenumbers>3</expected-linenumbers>
        <expected-messages>
            <message>Suspicious decimal characters following octal escape in string literal: \12 + 8</message>
        </expected-messages>
        <code><![CDATA[
public class Foo {
    void bar() {
        System.out.println("foo = \128");
    }
}
        ]]></code>
    </test-code>

    <test-code>
        <description>should be flagged - different octal</description>
        <expected-problems>1</expected-problems>
        <expected-messages>
            <message>Suspicious decimal characters following octal escape in string literal: \000 + 8</message>
        </expected-messages>
        <code><![CDATA[
public class Foo {
    void bar() {
        System.out.println("foo = \0008");
    }
}
        ]]></code>
    </test-code>

    <test-code>
        <description>should be flagged - different octal</description>
        <expected-problems>1</expected-problems>
        <expected-messages>
            <message>Suspicious decimal characters following octal escape in string literal: \40 + 0</message>
        </expected-messages>
        <code><![CDATA[
public class Foo {
    void bar() {
        System.out.println("foo = \4008");
    }
}
        ]]></code>
    </test-code>

    <test-code>
        <description>[ 2050064 ] False + SuspiciousOctalEscape with backslash literal</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
    void bar() {
        System.out.println("suspicious: \\128");
    }
}
        ]]></code>
    </test-code>

    <test-code>
        <description>[ 2050064 ] False + SuspiciousOctalEscape with backslash literal, second test case</description>
        <expected-problems>1</expected-problems>
        <expected-messages>
            <message>Suspicious decimal characters following octal escape in string literal: \12 + 8</message>
        </expected-messages>
        <code><![CDATA[
public class Foo {
    void bar() {
        System.out.println("suspicious: \\128 \128");
    }
}
        ]]></code>
    </test-code>
</test-data>
