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: 18 | Number of AST nodes: 18 | |||
1 | s = Commandline.translateCommandline("1 \'2\' 3");↵ | |||
2 | assertEquals("Simple case with single quotes", 3, s.length);↵ | |||
3 | assertEquals("Single quotes have been stripped", "2", s[1]);↵ | |||
4 | s = Commandline.translateCommandline("1 \"2\" 3");↵ | |||
5 | assertEquals("Simple case with double quotes", 3, s.length);↵ | |||
6 | assertEquals("Double quotes have been stripped", "2", s[1]);↵ | |||
1 | s = Commandline.translateCommandline("1 \"2 3\" 4");↵ | 7 | s = Commandline.translateCommandline("1 \"2 3\" 4");↵ | |
2 | assertEquals("Case with double quotes and whitespace", 3, s.length);↵ | 8 | assertEquals("Case with double quotes and whitespace", 3, s.length);↵ | |
3 | assertEquals("Double quotes stripped, space included", "2 3", s[1]);↵ | 9 | assertEquals("Double quotes stripped, space included", "2 3", s[1]);↵ | |
4 | s = Commandline.translateCommandline("1 \"2\'3\" 4");↵ | 10 | s = Commandline.translateCommandline("1 \"2\'3\" 4");↵ | |
5 | assertEquals("Case with double quotes around single quote", 3, s.length);↵ | 11 | assertEquals("Case with double quotes around single quote", 3, s.length);↵ | |
6 | assertEquals("Double quotes stripped, single quote included", "2\'3",↵ | 12 | assertEquals("Double quotes stripped, single quote included", "2\'3",↵ | |
7 | s[1]);↵ | 13 | s[1]);↵ | |
8 | s = Commandline.translateCommandline("1 \'2 3\' 4");↵ | 14 | s = Commandline.translateCommandline("1 \'2 3\' 4");↵ | |
9 | assertEquals("Case with single quotes and whitespace", 3, s.length);↵ | 15 | assertEquals("Case with single quotes and whitespace", 3, s.length);↵ | |
10 | assertEquals("Single quotes stripped, space included", "2 3", s[1]);↵ | 16 | assertEquals("Single quotes stripped, space included", "2 3", s[1]);↵ | |
11 | s = Commandline.translateCommandline("1 \'2\"3\' 4");↵ | 17 | s = Commandline.translateCommandline("1 \'2\"3\' 4");↵ | |
12 | assertEquals("Case with single quotes around double quote", 3, s.length);↵ | 18 | assertEquals("Case with single quotes around double quote", 3, s.length);↵ | |
13 | assertEquals("Single quotes stripped, double quote included", "2\"3",↵ | 19 | assertEquals("Single quotes stripped, double quote included", "2\"3",↵ | |
14 | s[1]);↵ | 20 |
| |
15 | // \ doesn't have a special meaning anymore - this is different from↵ | |||
16 | // what the Unix sh does but causes a lot of problems on DOS↵ | |||
17 | // based platforms otherwise↵ | |||
18 | s = Commandline.translateCommandline("1 2\\ 3 4");↵ | |||
19 | assertEquals("case with quoted whitespace", 4, s.length);↵ | |||
20 | assertEquals("backslash included", "2\\", s[1]);↵ | |||
21 | // "" should become a single empty argument, same for ''↵ | |||
22 | // PR 5906↵ | |||
23 | s = Commandline.translateCommandline("\"\" a");↵ | |||
24 | assertEquals("Doublequoted null arg prepend", 2, s.length);↵ | |||
25 | assertEquals("Doublequoted null arg prepend", "", s[0]); | |||
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.0 |
Clones location | Clones are in the same method |
Number of node comparisons | 324 |
Number of mapped statements | 18 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
15 | s = Commandline.translateCommandline("1 \"2 3\" 4"); |
| 9 | s = Commandline.translateCommandline("1 \'2\' 3"); | ||||||||||||||||
16 | assertEquals("Case with double quotes and whitespace", 3, s.length); |
| 10 | assertEquals("Simple case with single quotes", 3, s.length); | ||||||||||||||||
17 | assertEquals("Double quotes stripped, space included", "2 3", s[1]); | 17 | assertEquals("Double quotes stripped, space included", "2 3", s[1]); | |||||||||||||||||
18 | s = Commandline.translateCommandline("1 \"2\'3\" 4"); |
| 12 | s = Commandline.translateCommandline("1 \"2\" 3"); | ||||||||||||||||
19 | assertEquals("Case with double quotes around single quote", 3, s.length); |
| 13 | assertEquals("Simple case with double quotes", 3, s.length); | ||||||||||||||||
20 | assertEquals("Double quotes stripped, single quote included", "2\'3", s[1]); | 20 | assertEquals("Double quotes stripped, single quote included", "2\'3", s[1]); | |||||||||||||||||
21 | s = Commandline.translateCommandline("1 \'2 3\' 4"); |
| 15 | s = Commandline.translateCommandline("1 \"2 3\" 4"); | ||||||||||||||||
22 | assertEquals("Case with single quotes and whitespace", 3, s.length); |
| 16 | assertEquals("Case with double quotes and whitespace", 3, s.length); | ||||||||||||||||
23 | assertEquals("Single quotes stripped, space included", "2 3", s[1]); | 23 | assertEquals("Single quotes stripped, space included", "2 3", s[1]); | |||||||||||||||||
24 | s = Commandline.translateCommandline("1 \'2\"3\' 4"); |
| 18 | s = Commandline.translateCommandline("1 \"2\'3\" 4"); | ||||||||||||||||
25 | assertEquals("Case with single quotes around double quote", 3, s.length); |
| 19 | assertEquals("Case with double quotes around single quote", 3, 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]); | |||||||||||||||||
27 | s = Commandline.translateCommandline("1 2\\ 3 4"); |
| 21 | s = Commandline.translateCommandline("1 \'2 3\' 4"); | ||||||||||||||||
28 | assertEquals("case with quoted whitespace", 4, s.length); |
| 22 | assertEquals("Case with single quotes and whitespace", 3, s.length); | ||||||||||||||||
29 | assertEquals("backslash included", "2\\", s[1]); |
| 11 | assertEquals("Single quotes have been stripped", "2", s[1]); | ||||||||||||||||
30 | s = Commandline.translateCommandline("\"\" a"); |
| 24 | s = Commandline.translateCommandline("1 \'2\"3\' 4"); | ||||||||||||||||
31 | assertEquals("Doublequoted null arg prepend", 2, s.length); |
| 25 | assertEquals("Case with single quotes around double quote", 3, s.length); | ||||||||||||||||
32 | assertEquals("Doublequoted null arg prepend", "", s[0]); |
| 14 | assertEquals("Double quotes have been stripped", "2", s[1]); |
Row | Violation |
---|---|
1 | Clone fragment #1 returns variables s , while Clone fragment #2 returns variables |