Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
1e3834aa
Commit
1e3834aa
authored
Oct 08, 2012
by
Francois Gouget
Committed by
Alexandre Julliard
Oct 09, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32/tests: Fix test_one_cmdline() and add a few more tests.
test_one_cmdline() did not check the last parameter.
parent
9b2eb6e6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
8 deletions
+28
-8
shlexec.c
dlls/shell32/tests/shlexec.c
+28
-8
No files found.
dlls/shell32/tests/shlexec.c
View file @
1e3834aa
...
...
@@ -979,6 +979,9 @@ typedef struct
static
const
cmdline_tests_t
cmdline_tests
[]
=
{
{
"exe"
,
{
"exe"
,
NULL
},
0
},
{
"exe arg1 arg2
\"
arg three
\"
'four five` six
\\
$even)"
,
{
"exe"
,
"arg1"
,
"arg2"
,
"arg three"
,
"'four"
,
"five`"
,
"six
\\
"
,
"$even)"
,
NULL
},
0
},
...
...
@@ -988,6 +991,13 @@ static const cmdline_tests_t cmdline_tests[] =
{
"exe arg
\"
one
\"
\"
second
\"
arg thirdarg "
,
{
"exe"
,
"argone"
,
"secondarg"
,
"thirdarg"
,
NULL
},
0
},
/* Don't lose unclosed quoted arguments */
{
"exe arg1
\"
unclosed"
,
{
"exe"
,
"arg1"
,
"unclosed"
,
NULL
},
0
},
{
"exe arg1
\"
"
,
{
"exe"
,
"arg1"
,
""
,
NULL
},
0
},
/* cmd's metacharacters have no special meaning */
{
"exe
\"
one^
\"
\"
arg
\"
&two three|four"
,
{
"exe"
,
"one^"
,
"arg&two"
,
"three|four"
,
NULL
},
0
},
...
...
@@ -1073,6 +1083,10 @@ static const cmdline_tests_t cmdline_tests[] =
{
"exe
\"
twelve
\"\"\"\"\"\"\"\"\"\"\"\"
quotes
\"
next 13%3=1"
,
{
"exe"
,
"twelve
\"\"\"\"
quotes"
,
"next"
,
"13%3=1"
,
NULL
},
0x20
},
/* Escaped consecutive quotes are fun */
{
"exe
\"
the crazy
\\\\\"\"\"\\\\\"
quotes"
,
{
"exe"
,
"the crazy
\\\"\\
"
,
"quotes"
,
NULL
},
0x21
},
/* The executable path has its own rules!!!
* - Backslashes have no special meaning.
* - If the first character is a quote, then the second quote ends the
...
...
@@ -1085,7 +1099,10 @@ static const cmdline_tests_t cmdline_tests[] =
* argument, the latter is parsed using the regular rules.
*/
{
"exe
\"
file
\"
path arg1"
,
{
"exe
\"
file
\"
path"
,
"arg1"
,
NULL
},
0x30
},
{
"exe
\"
file
\"
path"
,
"arg1"
,
NULL
},
0x10
},
{
"exe
\"
file
\"
path
\t
arg1"
,
{
"exe
\"
file
\"
path"
,
"arg1"
,
NULL
},
0x10
},
{
"exe
\"
path
\\
arg1"
,
{
"exe
\"
path
\\
"
,
"arg1"
,
NULL
},
0x31
},
...
...
@@ -1096,6 +1113,9 @@ static const cmdline_tests_t cmdline_tests[] =
{
"
\"
spaced exe
\"
\"
next arg
\"
"
,
{
"spaced exe"
,
"next arg"
,
NULL
},
0
},
{
"
\"
spaced exe
\"\t\"
next arg
\"
"
,
{
"spaced exe"
,
"next arg"
,
NULL
},
0
},
{
"
\"
exe
\"
arg
\"
one
\"
argtwo"
,
{
"exe"
,
"arg one"
,
"argtwo"
,
NULL
},
0x31
},
...
...
@@ -1103,13 +1123,13 @@ static const cmdline_tests_t cmdline_tests[] =
{
"spaced exe
\\
"
,
"arg1"
,
"arg2"
,
NULL
},
0x11
},
{
"
\"
two
\"\"
arg1 "
,
{
"two"
,
" arg1 "
,
NULL
},
0x
2
1
},
{
"two"
,
" arg1 "
,
NULL
},
0x
1
1
},
{
"
\"
three
\"\"\"
arg2"
,
{
"three"
,
""
,
"arg2"
,
NULL
},
0x61
},
{
"
\"
four
\"\"\"\"
arg1"
,
{
"four"
,
"
\"
arg1"
,
NULL
},
0x
2
1
},
{
"four"
,
"
\"
arg1"
,
NULL
},
0x
1
1
},
/* If the first character is a space then the executable path is empty */
{
"
\"
arg
\"
one argtwo"
,
...
...
@@ -1143,9 +1163,9 @@ static BOOL test_one_cmdline(const cmdline_tests_t* test)
else
todo_wine
ok
(
cl2a_count
==
count
,
"%s: expected %d arguments, but got %d
\n
"
,
test
->
cmd
,
count
,
cl2a_count
);
for
(
i
=
0
;
i
<
cl2a_count
-
1
;
i
++
)
for
(
i
=
0
;
i
<
cl2a_count
;
i
++
)
{
if
(
test
->
args
[
i
]
)
if
(
i
<
count
)
{
MultiByteToWideChar
(
CP_ACP
,
0
,
test
->
args
[
i
],
-
1
,
argW
,
sizeof
(
argW
)
/
sizeof
(
*
argW
));
if
((
test
->
todo
&
(
1
<<
(
i
+
4
)))
==
0
)
...
...
@@ -1250,7 +1270,7 @@ static const argify_tests_t argify_tests[] =
/* Only (double-)quotes have a special meaning. */
{
"Params23456"
,
"'p2 p3` p4
\\
$even"
,
0x40
,
{
"
\"
'p2
\"
\"
p3`
\"
\"
p4
\\\"
\"
$even
\"
\"\"
"
,
{
""
,
"'p2"
,
"p3`"
,
"p4
\"
$even
\"
"
,
NULL
},
0
}},
{
""
,
"'p2"
,
"p3`"
,
"p4
\"
$even
\"
"
,
NULL
},
0
x80
}},
{
"Params23456"
,
"p=2 p-3 p4
\t
p4
\r
p4
\n
p4"
,
0x1c2
,
{
"
\"
p=2
\"
\"
p-3
\"
\"
p4
\t
p4
\r
p4
\n
p4
\"
\"\"
\"\"
"
,
...
...
@@ -1272,7 +1292,7 @@ static const argify_tests_t argify_tests[] =
{
"Params23456789"
,
"three
\"\"\"
quotes
\"
p four
\"
three
\"\"\"
quotes p6"
,
0xff3
,
{
"
\"
three
\"\"
\"
quotes
\"
\"
p four
\"
\"
three
\"\"
\"
quotes
\"
\"
p6
\"
\"\"
\"\"
"
,
{
""
,
"three
\"
"
,
"quotes"
,
"p four"
,
"three
\"
"
,
"quotes"
,
"p6"
,
""
,
""
,
NULL
},
0x
3
e1
}},
{
""
,
"three
\"
"
,
"quotes"
,
"p four"
,
"three
\"
"
,
"quotes"
,
"p6"
,
""
,
""
,
NULL
},
0x
7
e1
}},
{
"Params23456789"
,
"four
\"\"\"\"
quotes
\"
p three
\"
four
\"\"\"\"
quotes p5"
,
0xf3
,
{
"
\"
four
\"\"
quotes
\"
\"
p three
\"
\"
four
\"\"
quotes
\"
\"
p5
\"
\"\"
\"\"
\"\"
\"\"
"
,
...
...
@@ -1319,7 +1339,7 @@ static const argify_tests_t argify_tests[] =
{
"Params23456789"
,
"
\"\"\"\"
fourquotes
\"
p four
\"
\"\"\"\"
fourquotes p7"
,
0xbf3
,
{
"
\"\"\"
\"
fourquotes
\"
\"
p four
\"
\"\"\"
\"
fourquotes
\"
\"
p7
\"
\"\"
\"\"
"
,
{
""
,
"
\"
"
,
"fourquotes"
,
"p four"
,
"
\"
"
,
"fourquotes"
,
"p7"
,
""
,
""
,
NULL
},
0x
3
e1
}},
{
""
,
"
\"
"
,
"fourquotes"
,
"p four"
,
"
\"
"
,
"fourquotes"
,
"p7"
,
""
,
""
,
NULL
},
0x
7
e1
}},
/* An unclosed quoted string gets lost! */
{
"Params23456"
,
"p2
\"
p3
\"
\"
p4 is lost"
,
0x1c3
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment