s = Commandline.translateCommandline("1 \'2 3\' 4"); assertEquals("Case with single quotes and whitespace", 3, s.length); assertEquals("Single quotes stripped, space included", "2 3", s[1]); s = Commandline.translateCommandline("1 \'2\"3\' 4"); assertEquals("Case with single quotes around double quote", 3, s.length); assertEquals("Single quotes stripped, double quote included", "2\"3", s[1]);
s = Commandline.translateCommandline("\"\""); assertEquals("Doublequoted null arg", 1, s.length); 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]);
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: 6 Number of AST nodes: 6
1
s = Commandline.translateCommandline("1 \'2 3\' 4");
1
s = Commandline.translateCommandline("\"\"");
2
        assertEquals("Case with single quotes and whitespace", 3, s.length);
2
        assertEquals("Doublequoted null arg", 1, s.length);
3
        assertEquals("Single quotes stripped, space included", "2 3", s[1]);
3
        assertEquals("Doublequoted null arg", "", s[0]);
4
        s = Commandline.translateCommandline("1 \'2\"3\' 4");
4
        s = Commandline.translateCommandline("\'\' a");
5
        assertEquals("Case with single quotes around double quote", 3, s.length);
5
        assertEquals("Singlequoted null arg prepend", 2, s.length);
6
        assertEquals("Single quotes stripped, double quote included", "2\"3",
6
        assertEquals("Singlequote
7
                     s[1]);
7
d null arg prepend", "", s[0]);
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones locationClones are in the same method
Number of node comparisons36
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    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
    21
    s = Commandline.translateCommandline("1 \'2 3\' 4");
    21
    s = Commandline.translateCommandline("1 \'2 3\' 4");
    38
    s = Commandline.translateCommandline("\"\"");
    Differences
    Expression1Expression2Difference
    "1 \'2 3\' 4""\"\""LITERAL_VALUE_MISMATCH
    38
    s = Commandline.translateCommandline("\"\"");
    22
    assertEquals("Case with single quotes and whitespace", 3, s.length);
    22
    assertEquals("Case with single quotes and whitespace", 3, s.length);
    39
    assertEquals("Doublequoted null arg", 1, s.length);
    Differences
    Expression1Expression2Difference
    "Case with single quotes and whitespace""Doublequoted null arg"LITERAL_VALUE_MISMATCH
    31LITERAL_VALUE_MISMATCH
    39
    assertEquals("Doublequoted null arg", 1, s.length);
    23
    assertEquals("Single quotes stripped, space included", "2 3", s[1]);
    23
    assertEquals("Single quotes stripped, space included", "2 3", s[1]);
    43
    assertEquals("Singlequoted null arg prepend", "", s[0]);
    Differences
    Expression1Expression2Difference
    "Single quotes stripped, space included""Singlequoted null arg prepend"LITERAL_VALUE_MISMATCH
    "2 3"""LITERAL_VALUE_MISMATCH
    10LITERAL_VALUE_MISMATCH
    43
    assertEquals("Singlequoted null arg prepend", "", s[0]);
    24
    s = Commandline.translateCommandline("1 \'2\"3\' 4");
    24
    s = Commandline.translateCommandline("1 \'2\"3\' 4");
    41
    s = Commandline.translateCommandline("\'\' a");
    Differences
    Expression1Expression2Difference
    "1 \'2\"3\' 4""\'\' a"LITERAL_VALUE_MISMATCH
    41
    s = Commandline.translateCommandline("\'\' a");
    25
    assertEquals("Case with single quotes around double quote", 3, s.length);
    25
    assertEquals("Case with single quotes around double quote", 3, s.length);
    42
    assertEquals("Singlequoted null arg prepend", 2, s.length);
    Differences
    Expression1Expression2Difference
    "Case with single quotes around double quote""Singlequoted null arg prepend"LITERAL_VALUE_MISMATCH
    32LITERAL_VALUE_MISMATCH
    42
    assertEquals("Singlequoted null arg prepend", 2, s.length);
    26
    assertEquals("Single quotes stripped, double quote included", "2\"3", s[1]);
    26
    assertEquals("Single quotes stripped, double quote included", "2\"3", s[1]);
    40
    assertEquals("Doublequoted null arg", "", s[0]);
    Differences
    Expression1Expression2Difference
    "Single quotes stripped, double quote included""Doublequoted null arg"LITERAL_VALUE_MISMATCH
    "2\"3"""LITERAL_VALUE_MISMATCH
    10LITERAL_VALUE_MISMATCH
    40
    assertEquals("Doublequoted null arg", "", s[0]);
    Precondition Violations (1)
    Row Violation
    1Clone fragment #1 returns variables , while Clone fragment #2 returns variables s