mirror of
https://github.com/tailix/libkernaux.git
synced 2024-11-13 11:04:27 -05:00
Common: more generated tests for cmdline
This commit is contained in:
parent
2d1e37f688
commit
5c648a37c7
2 changed files with 133 additions and 101 deletions
|
@ -93,3 +93,136 @@
|
||||||
argv_count_max: 2
|
argv_count_max: 2
|
||||||
buffer_size: 11
|
buffer_size: 11
|
||||||
error: 'too many args'
|
error: 'too many args'
|
||||||
|
|
||||||
|
- cmdline: '\\ '
|
||||||
|
result: [' ']
|
||||||
|
- cmdline: '\"\\ \"'
|
||||||
|
result: [' ']
|
||||||
|
- cmdline: '\\\\'
|
||||||
|
result: ['\\']
|
||||||
|
- cmdline: '\"\\\\\"'
|
||||||
|
result: ['\\']
|
||||||
|
- cmdline: '\\\"'
|
||||||
|
result: ['\"']
|
||||||
|
- cmdline: '\"\\\"\"'
|
||||||
|
result: ['\"']
|
||||||
|
- cmdline: 'foo\\ '
|
||||||
|
result: ['foo ']
|
||||||
|
- cmdline: '\"foo\\ \"'
|
||||||
|
result: ['foo ']
|
||||||
|
- cmdline: 'foo\\\\'
|
||||||
|
result: ['foo\\']
|
||||||
|
- cmdline: '\"foo\\\\\"'
|
||||||
|
result: ['foo\\']
|
||||||
|
- cmdline: 'foo\\\"'
|
||||||
|
result: ['foo\"']
|
||||||
|
- cmdline: '\"foo\\\"\"'
|
||||||
|
result: ['foo\"']
|
||||||
|
- cmdline: '\\ foo'
|
||||||
|
result: [' foo']
|
||||||
|
- cmdline: '\"\\ foo\"'
|
||||||
|
result: [' foo']
|
||||||
|
- cmdline: '\\\\foo'
|
||||||
|
result: ['\\foo']
|
||||||
|
- cmdline: '\"\\\\foo\"'
|
||||||
|
result: ['\\foo']
|
||||||
|
- cmdline: '\\\"foo'
|
||||||
|
result: ['\"foo']
|
||||||
|
- cmdline: '\"\\\"foo\"'
|
||||||
|
result: ['\"foo']
|
||||||
|
- cmdline: '\\ foo\\ '
|
||||||
|
result: [' foo ']
|
||||||
|
- cmdline: '\"\\ foo\\ \"'
|
||||||
|
result: [' foo ']
|
||||||
|
- cmdline: '\\\\foo\\\\'
|
||||||
|
result: ['\\foo\\']
|
||||||
|
- cmdline: '\"\\\\foo\\\\\"'
|
||||||
|
result: ['\\foo\\']
|
||||||
|
- cmdline: '\\\"foo\\\"'
|
||||||
|
result: ['\"foo\"']
|
||||||
|
- cmdline: '\"\\\"foo\\\"\"'
|
||||||
|
result: ['\"foo\"']
|
||||||
|
- cmdline: 'foo\\ bar'
|
||||||
|
result: ['foo bar']
|
||||||
|
- cmdline: '\"foo\\ bar\"'
|
||||||
|
result: ['foo bar']
|
||||||
|
- cmdline: 'foo\\\\bar'
|
||||||
|
result: ['foo\\bar']
|
||||||
|
- cmdline: '\"foo\\\\bar\"'
|
||||||
|
result: ['foo\\bar']
|
||||||
|
- cmdline: 'foo\\\"bar'
|
||||||
|
result: ['foo\"bar']
|
||||||
|
- cmdline: '\"foo\\\"bar\"'
|
||||||
|
result: ['foo\"bar']
|
||||||
|
- cmdline: '\\ foo bar'
|
||||||
|
result: [' foo', 'bar']
|
||||||
|
- cmdline: '\"\\ foo\" bar'
|
||||||
|
result: [' foo', 'bar']
|
||||||
|
- cmdline: '\\\\foo bar'
|
||||||
|
result: ['\\foo', 'bar']
|
||||||
|
- cmdline: '\"\\\\foo\" bar'
|
||||||
|
result: ['\\foo', 'bar']
|
||||||
|
- cmdline: '\\\"foo bar'
|
||||||
|
result: ['\"foo', 'bar']
|
||||||
|
- cmdline: '\"\\\"foo\" bar'
|
||||||
|
result: ['\"foo', 'bar']
|
||||||
|
- cmdline: 'foo\\ bar'
|
||||||
|
result: ['foo ', 'bar']
|
||||||
|
- cmdline: '\"foo\\ \" bar'
|
||||||
|
result: ['foo ', 'bar']
|
||||||
|
- cmdline: 'foo\\\\ bar'
|
||||||
|
result: ['foo\\', 'bar']
|
||||||
|
- cmdline: '\"foo\\\\\" bar'
|
||||||
|
result: ['foo\\', 'bar']
|
||||||
|
- cmdline: 'foo\\\" bar'
|
||||||
|
result: ['foo\"', 'bar']
|
||||||
|
- cmdline: '\"foo\\\"\" bar'
|
||||||
|
result: ['foo\"', 'bar']
|
||||||
|
- cmdline: '\\ foo\\ bar'
|
||||||
|
result: [' foo ', 'bar']
|
||||||
|
- cmdline: '\"\\ foo\\ \" bar'
|
||||||
|
result: [' foo ', 'bar']
|
||||||
|
- cmdline: '\\\\foo\\\\ bar'
|
||||||
|
result: ['\\foo\\', 'bar']
|
||||||
|
- cmdline: '\"\\\\foo\\\\\" bar'
|
||||||
|
result: ['\\foo\\', 'bar']
|
||||||
|
- cmdline: '\\\"foo\\\" bar'
|
||||||
|
result: ['\"foo\"', 'bar']
|
||||||
|
- cmdline: '\"\\\"foo\\\"\" bar'
|
||||||
|
result: ['\"foo\"', 'bar']
|
||||||
|
- cmdline: 'foo \\ bar'
|
||||||
|
result: ['foo', ' bar']
|
||||||
|
- cmdline: 'foo \"\\ bar\"'
|
||||||
|
result: ['foo', ' bar']
|
||||||
|
- cmdline: 'foo \\\\bar'
|
||||||
|
result: ['foo', '\\bar']
|
||||||
|
- cmdline: 'foo \"\\\\bar\"'
|
||||||
|
result: ['foo', '\\bar']
|
||||||
|
- cmdline: 'foo \\\"bar'
|
||||||
|
result: ['foo', '\"bar']
|
||||||
|
- cmdline: 'foo \"\\\"bar\"'
|
||||||
|
result: ['foo', '\"bar']
|
||||||
|
- cmdline: 'foo bar\\ '
|
||||||
|
result: ['foo', 'bar ']
|
||||||
|
- cmdline: 'foo \"bar\\ \"'
|
||||||
|
result: ['foo', 'bar ']
|
||||||
|
- cmdline: 'foo bar\\\\'
|
||||||
|
result: ['foo', 'bar\\']
|
||||||
|
- cmdline: 'foo \"bar\\\\\"'
|
||||||
|
result: ['foo', 'bar\\']
|
||||||
|
- cmdline: 'foo bar\\\"'
|
||||||
|
result: ['foo', 'bar\"']
|
||||||
|
- cmdline: 'foo \"bar\\\"\"'
|
||||||
|
result: ['foo', 'bar\"']
|
||||||
|
- cmdline: 'foo \\ bar\\ '
|
||||||
|
result: ['foo', ' bar ']
|
||||||
|
- cmdline: 'foo \"\\ bar\\ \"'
|
||||||
|
result: ['foo', ' bar ']
|
||||||
|
- cmdline: 'foo \\\\bar\\\\'
|
||||||
|
result: ['foo', '\\bar\\']
|
||||||
|
- cmdline: 'foo \"\\\\bar\\\\\"'
|
||||||
|
result: ['foo', '\\bar\\']
|
||||||
|
- cmdline: 'foo \\\"bar\\\"'
|
||||||
|
result: ['foo', '\"bar\"']
|
||||||
|
- cmdline: 'foo \"\\\"bar\\\"\"'
|
||||||
|
result: ['foo', '\"bar\"']
|
||||||
|
|
|
@ -31,40 +31,6 @@ static const char *const argv_quotmarkX3_X3[] = {"\"\"\"", "\"\"\"", "\"\"\""};
|
||||||
static const char *const argv_foospacebar_car[] = {"foo bar", "car"};
|
static const char *const argv_foospacebar_car[] = {"foo bar", "car"};
|
||||||
static const char *const argv_foo_barspacecar[] = {"foo", "bar car"};
|
static const char *const argv_foo_barspacecar[] = {"foo", "bar car"};
|
||||||
|
|
||||||
static const char *const argv_space[] = {" "};
|
|
||||||
static const char *const argv_backslash[] = {"\\"};
|
|
||||||
static const char *const argv_quotmark[] = {"\""};
|
|
||||||
static const char *const argv_foospace[] = {"foo "};
|
|
||||||
static const char *const argv_foobackslash[] = {"foo\\"};
|
|
||||||
static const char *const argv_fooquotmark[] = {"foo\""};
|
|
||||||
static const char *const argv_spacefoo[] = {" foo"};
|
|
||||||
static const char *const argv_backslashfoo[] = {"\\foo"};
|
|
||||||
static const char *const argv_quotmarkfoo[] = {"\"foo"};
|
|
||||||
static const char *const argv_spacefoospace[] = {" foo "};
|
|
||||||
static const char *const argv_backslashfoobackslash[] = {"\\foo\\"};
|
|
||||||
static const char *const argv_quotmarkfooquotmark[] = {"\"foo\""};
|
|
||||||
static const char *const argv_foospacebar[] = {"foo bar"};
|
|
||||||
static const char *const argv_foobackslashbar[] = {"foo\\bar"};
|
|
||||||
static const char *const argv_fooquotmarkbar[] = {"foo\"bar"};
|
|
||||||
static const char *const argv_spacefoo_bar[] = {" foo", "bar"};
|
|
||||||
static const char *const argv_backslashfoo_bar[] = {"\\foo", "bar"};
|
|
||||||
static const char *const argv_quotmarkfoo_bar[] = {"\"foo", "bar"};
|
|
||||||
static const char *const argv_foospace_bar[] = {"foo ", "bar"};
|
|
||||||
static const char *const argv_foobackslash_bar[] = {"foo\\", "bar"};
|
|
||||||
static const char *const argv_fooquotmark_bar[] = {"foo\"", "bar"};
|
|
||||||
static const char *const argv_spacefoospace_bar[] = {" foo ", "bar"};
|
|
||||||
static const char *const argv_backslashfoobackslash_bar[] = {"\\foo\\", "bar"};
|
|
||||||
static const char *const argv_quotmarkfooquotmark_bar[] = {"\"foo\"", "bar"};
|
|
||||||
static const char *const argv_foo_spacebar[] = {"foo", " bar"};
|
|
||||||
static const char *const argv_foo_backslashbar[] = {"foo", "\\bar"};
|
|
||||||
static const char *const argv_foo_quotmarkbar[] = {"foo", "\"bar"};
|
|
||||||
static const char *const argv_foo_barspace[] = {"foo", "bar "};
|
|
||||||
static const char *const argv_foo_barbackslash[] = {"foo", "bar\\"};
|
|
||||||
static const char *const argv_foo_barquotmark[] = {"foo", "bar\""};
|
|
||||||
static const char *const argv_foo_spacebarspace[] = {"foo", " bar "};
|
|
||||||
static const char *const argv_foo_backslashbarbackslash[] = {"foo", "\\bar\\"};
|
|
||||||
static const char *const argv_foo_quotmarkbarquotmark[] = {"foo", "\"bar\""};
|
|
||||||
|
|
||||||
static const char *const argv_aX50[] = {
|
static const char *const argv_aX50[] = {
|
||||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
||||||
};
|
};
|
||||||
|
@ -78,73 +44,6 @@ static const char *const argv_a_X6[] = { "a", "a", "a", "a", "a", "a" };
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
test("\\ ", 0, 0, true, "", 1, argv_space);
|
|
||||||
test("\"\\ \"", 0, 0, true, "", 1, argv_space);
|
|
||||||
test("\\\\", 0, 0, true, "", 1, argv_backslash);
|
|
||||||
test("\"\\\\\"", 0, 0, true, "", 1, argv_backslash);
|
|
||||||
test("\\\"", 0, 0, true, "", 1, argv_quotmark);
|
|
||||||
test("\"\\\"\"", 0, 0, true, "", 1, argv_quotmark);
|
|
||||||
test("foo\\ ", 0, 0, true, "", 1, argv_foospace);
|
|
||||||
test("\"foo\\ \"", 0, 0, true, "", 1, argv_foospace);
|
|
||||||
test("foo\\\\", 0, 0, true, "", 1, argv_foobackslash);
|
|
||||||
test("\"foo\\\\\"", 0, 0, true, "", 1, argv_foobackslash);
|
|
||||||
test("foo\\\"", 0, 0, true, "", 1, argv_fooquotmark);
|
|
||||||
test("\"foo\\\"\"", 0, 0, true, "", 1, argv_fooquotmark);
|
|
||||||
test("\\ foo", 0, 0, true, "", 1, argv_spacefoo);
|
|
||||||
test("\"\\ foo\"", 0, 0, true, "", 1, argv_spacefoo);
|
|
||||||
test("\\\\foo", 0, 0, true, "", 1, argv_backslashfoo);
|
|
||||||
test("\"\\\\foo\"", 0, 0, true, "", 1, argv_backslashfoo);
|
|
||||||
test("\\\"foo", 0, 0, true, "", 1, argv_quotmarkfoo);
|
|
||||||
test("\"\\\"foo\"", 0, 0, true, "", 1, argv_quotmarkfoo);
|
|
||||||
test("\\ foo\\ ", 0, 0, true, "", 1, argv_spacefoospace);
|
|
||||||
test("\"\\ foo\\ \"", 0, 0, true, "", 1, argv_spacefoospace);
|
|
||||||
test("\\\\foo\\\\", 0, 0, true, "", 1, argv_backslashfoobackslash);
|
|
||||||
test("\"\\\\foo\\\\\"", 0, 0, true, "", 1, argv_backslashfoobackslash);
|
|
||||||
test("\\\"foo\\\"", 0, 0, true, "", 1, argv_quotmarkfooquotmark);
|
|
||||||
test("\"\\\"foo\\\"\"", 0, 0, true, "", 1, argv_quotmarkfooquotmark);
|
|
||||||
test("foo\\ bar", 0, 0, true, "", 1, argv_foospacebar);
|
|
||||||
test("\"foo\\ bar\"", 0, 0, true, "", 1, argv_foospacebar);
|
|
||||||
test("foo\\\\bar", 0, 0, true, "", 1, argv_foobackslashbar);
|
|
||||||
test("\"foo\\\\bar\"", 0, 0, true, "", 1, argv_foobackslashbar);
|
|
||||||
test("foo\\\"bar", 0, 0, true, "", 1, argv_fooquotmarkbar);
|
|
||||||
test("\"foo\\\"bar\"", 0, 0, true, "", 1, argv_fooquotmarkbar);
|
|
||||||
test("\\ foo bar", 0, 0, true, "", 2, argv_spacefoo_bar);
|
|
||||||
test("\"\\ foo\" bar", 0, 0, true, "", 2, argv_spacefoo_bar);
|
|
||||||
test("\\\\foo bar", 0, 0, true, "", 2, argv_backslashfoo_bar);
|
|
||||||
test("\"\\\\foo\" bar", 0, 0, true, "", 2, argv_backslashfoo_bar);
|
|
||||||
test("\\\"foo bar", 0, 0, true, "", 2, argv_quotmarkfoo_bar);
|
|
||||||
test("\"\\\"foo\" bar", 0, 0, true, "", 2, argv_quotmarkfoo_bar);
|
|
||||||
test("foo\\ bar", 0, 0, true, "", 2, argv_foospace_bar);
|
|
||||||
test("\"foo\\ \" bar", 0, 0, true, "", 2, argv_foospace_bar);
|
|
||||||
test("foo\\\\ bar", 0, 0, true, "", 2, argv_foobackslash_bar);
|
|
||||||
test("\"foo\\\\\" bar", 0, 0, true, "", 2, argv_foobackslash_bar);
|
|
||||||
test("foo\\\" bar", 0, 0, true, "", 2, argv_fooquotmark_bar);
|
|
||||||
test("\"foo\\\"\" bar", 0, 0, true, "", 2, argv_fooquotmark_bar);
|
|
||||||
test("\\ foo\\ bar", 0, 0, true, "", 2, argv_spacefoospace_bar);
|
|
||||||
test("\"\\ foo\\ \" bar", 0, 0, true, "", 2, argv_spacefoospace_bar);
|
|
||||||
test("\\\\foo\\\\ bar", 0, 0, true, "", 2, argv_backslashfoobackslash_bar);
|
|
||||||
test("\"\\\\foo\\\\\" bar", 0, 0, true, "", 2, argv_backslashfoobackslash_bar);
|
|
||||||
test("\\\"foo\\\" bar", 0, 0, true, "", 2, argv_quotmarkfooquotmark_bar);
|
|
||||||
test("\"\\\"foo\\\"\" bar", 0, 0, true, "", 2, argv_quotmarkfooquotmark_bar);
|
|
||||||
test("foo \\ bar", 0, 0, true, "", 2, argv_foo_spacebar);
|
|
||||||
test("foo \"\\ bar\"", 0, 0, true, "", 2, argv_foo_spacebar);
|
|
||||||
test("foo \\\\bar", 0, 0, true, "", 2, argv_foo_backslashbar);
|
|
||||||
test("foo \"\\\\bar\"", 0, 0, true, "", 2, argv_foo_backslashbar);
|
|
||||||
test("foo \\\"bar", 0, 0, true, "", 2, argv_foo_quotmarkbar);
|
|
||||||
test("foo \"\\\"bar\"", 0, 0, true, "", 2, argv_foo_quotmarkbar);
|
|
||||||
test("foo bar\\ ", 0, 0, true, "", 2, argv_foo_barspace);
|
|
||||||
test("foo \"bar\\ \"", 0, 0, true, "", 2, argv_foo_barspace);
|
|
||||||
test("foo bar\\\\", 0, 0, true, "", 2, argv_foo_barbackslash);
|
|
||||||
test("foo \"bar\\\\\"", 0, 0, true, "", 2, argv_foo_barbackslash);
|
|
||||||
test("foo bar\\\"", 0, 0, true, "", 2, argv_foo_barquotmark);
|
|
||||||
test("foo \"bar\\\"\"", 0, 0, true, "", 2, argv_foo_barquotmark);
|
|
||||||
test("foo \\ bar\\ ", 0, 0, true, "", 2, argv_foo_spacebarspace);
|
|
||||||
test("foo \"\\ bar\\ \"", 0, 0, true, "", 2, argv_foo_spacebarspace);
|
|
||||||
test("foo \\\\bar\\\\", 0, 0, true, "", 2, argv_foo_backslashbarbackslash);
|
|
||||||
test("foo \"\\\\bar\\\\\"", 0, 0, true, "", 2, argv_foo_backslashbarbackslash);
|
|
||||||
test("foo \\\"bar\\\"", 0, 0, true, "", 2, argv_foo_quotmarkbarquotmark);
|
|
||||||
test("foo \"\\\"bar\\\"\"", 0, 0, true, "", 2, argv_foo_quotmarkbarquotmark);
|
|
||||||
|
|
||||||
test("foo\\ bar car", 0, 0, true, "", 2, argv_foospacebar_car);
|
test("foo\\ bar car", 0, 0, true, "", 2, argv_foospacebar_car);
|
||||||
test("\"foo bar\" car", 0, 0, true, "", 2, argv_foospacebar_car);
|
test("\"foo bar\" car", 0, 0, true, "", 2, argv_foospacebar_car);
|
||||||
test("\"foo bar\" \"car\"", 0, 0, true, "", 2, argv_foospacebar_car);
|
test("\"foo bar\" \"car\"", 0, 0, true, "", 2, argv_foospacebar_car);
|
||||||
|
|
Loading…
Reference in a new issue