assertEquals("backslash included", "2\\", s[1]); // "" should become a single empty argument, same for '' // PR 5906 s = Commandline.translateCommandline("\"\" a"); assertEquals("Doublequoted null arg prepend", 2, s.length); assertEquals("Doublequoted null arg prepend", "", s[0]); assertEquals("Doublequoted null arg prepend", "a", s[1]); s = Commandline.translateCommandline("a \"\""); assertEquals("Doublequoted null arg append", 2, s.length); assertEquals("Doublequoted null arg append", "a", s[0]);
assertEquals("Doublequoted null arg", "", s[0]); s = Commandline.translateCommandline("\'\' a"); assertEquals("Singlequoted null arg prepend", 2, s.length); assertEquals("Singlequoted null arg prepend", "", s[0]); assertEquals("Singlequoted null arg prepend", "a", s[1]); s = Commandline.translateCommandline("a \'\'"); assertEquals("Singlequoted null arg append", 2, s.length); assertEquals("Singlequoted null arg append", "a", s[0]);
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/CommandlineTest.java File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/CommandlineTest.java
Method name: void testTokenizer() Method name: void testTokenizer()
Number of AST nodes: 8 Number of AST nodes: 8
1
assertEquals("backslash included", "2\\", s[1]);
1
assertEquals("Doublequoted null arg", "", s[0]);
2
        // "" should become a single empty argument, same for ''
3
        // PR 5906
4
        s = Commandline.translateCommandline("\"\" a");
2
        s = Commandline.translateCommandline("\'\' a");
5
        assertEquals("Doublequoted null arg prepend", 2, s.length);
3
        assertEquals("Singlequoted null arg prepend", 2, s.length);
6
        assertEquals("Doublequoted null arg prepend", "", s[0]);
4
        assertEquals("Singlequoted null arg prepend", "", s[0]);
7
        assertEquals("Doublequoted null arg prepend", "a", s[1]);
5
        assertEquals("Singlequoted null arg prepend", "a", s[1]);
8
        s = Commandline.translateCommandline("a \"\"");
6
        s = Commandline.translateCommandline("a \'\'");
9
        assertEquals("Doublequoted null arg append", 2, s.length);
7
        assertEquals("Singlequoted null arg append", 2, s.length);
10
        assertEquals("Doublequoted null arg append", "a", s[0]);
8
        assertEquals("Singlequoted null arg append", "a", s[0]);
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones locationClones are in the same method
Number of node comparisons64
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    29
    assertEquals("backslash included", "2\\", s[1]);
    29
    assertEquals("backslash included", "2\\", s[1]);
    40
    assertEquals("Doublequoted null arg", "", s[0]);
    Differences
    Expression1Expression2Difference
    "backslash included""Doublequoted null arg"LITERAL_VALUE_MISMATCH
    "2\\"""LITERAL_VALUE_MISMATCH
    10LITERAL_VALUE_MISMATCH
    40
    assertEquals("Doublequoted null arg", "", s[0]);
    30
    s = Commandline.translateCommandline("\"\" a");
    30
    s = Commandline.translateCommandline("\"\" a");
    41
    s = Commandline.translateCommandline("\'\' a");
    Differences
    Expression1Expression2Difference
    "\"\" a""\'\' a"LITERAL_VALUE_MISMATCH
    41
    s = Commandline.translateCommandline("\'\' a");
    31
    assertEquals("Doublequoted null arg prepend", 2, s.length);
    31
    assertEquals("Doublequoted null arg prepend", 2, s.length);
    42
    assertEquals("Singlequoted null arg prepend", 2, s.length);
    Differences
    Expression1Expression2Difference
    "Doublequoted null arg prepend""Singlequoted null arg prepend"LITERAL_VALUE_MISMATCH
    42
    assertEquals("Singlequoted null arg prepend", 2, s.length);
    32
    assertEquals("Doublequoted null arg prepend", "", s[0]);
    32
    assertEquals("Doublequoted null arg prepend", "", s[0]);
    43
    assertEquals("Singlequoted null arg prepend", "", s[0]);
    Differences
    Expression1Expression2Difference
    "Doublequoted null arg prepend""Singlequoted null arg prepend"LITERAL_VALUE_MISMATCH
    43
    assertEquals("Singlequoted null arg prepend", "", s[0]);
    33
    assertEquals("Doublequoted null arg prepend", "a", s[1]);
    33
    assertEquals("Doublequoted null arg prepend", "a", s[1]);
    44
    assertEquals("Singlequoted null arg prepend", "a", s[1]);
    Differences
    Expression1Expression2Difference
    "Doublequoted null arg prepend""Singlequoted null arg prepend"LITERAL_VALUE_MISMATCH
    44
    assertEquals("Singlequoted null arg prepend", "a", s[1]);
    34
    s = Commandline.translateCommandline("a \"\"");
    34
    s = Commandline.translateCommandline("a \"\"");
    45
    s = Commandline.translateCommandline("a \'\'");
    Differences
    Expression1Expression2Difference
    "a \"\"""a \'\'"LITERAL_VALUE_MISMATCH
    45
    s = Commandline.translateCommandline("a \'\'");
    35
    assertEquals("Doublequoted null arg append", 2, s.length);
    35
    assertEquals("Doublequoted null arg append", 2, s.length);
    46
    assertEquals("Singlequoted null arg append", 2, s.length);
    Differences
    Expression1Expression2Difference
    "Doublequoted null arg append""Singlequoted null arg append"LITERAL_VALUE_MISMATCH
    46
    assertEquals("Singlequoted null arg append", 2, s.length);
    36
    assertEquals("Doublequoted null arg append", "a", s[0]);
    36
    assertEquals("Doublequoted null arg append", "a", s[0]);
    47
    assertEquals("Singlequoted null arg append", "a", s[0]);
    Differences
    Expression1Expression2Difference
    "Doublequoted null arg append""Singlequoted null arg append"LITERAL_VALUE_MISMATCH
    47
    assertEquals("Singlequoted null arg append", "a", s[0]);
    Precondition Violations (0)
    Row Violation