Browse Source

Update tests for the new share syntax.

Add more test cases to cover the new uses of the share= parameter.
master
Damien Goutte-Gattat 3 months ago
parent
commit
83b05346bc
  1. 16
      tests/t-parseuri.c

16
tests/t-parseuri.c

@ -84,9 +84,16 @@ struct test tests[] = {
0, GFSEC_SCHEME_FILE, "", "/path/to/share", 0, 1 },
{ "file:///path/to/share.123?share=no",
0, GFSEC_SCHEME_FILE, "", "/path/to/share.123", 0, 1 },
{ "file:///path/to/share?share=invalid", GFSEC_ERR_CONFIG_INVALID_URI },
{ "file:///path/to/share.123?share=invalid",
0, GFSEC_SCHEME_FILE, "", "/path/to/share.123", 123, 0 },
{ "file:///path/to/share?share=full",
0, GFSEC_SCHEME_FILE, "", "/path/to/share", 0, 1 },
{ "file:///path/to/share.123?share=full",
0, GFSEC_SCHEME_FILE, "", "/path/to/share.123", 0, 1 },
{ "file:///path/to/share?share=invalid", GFSEC_ERR_CONFIG_INVALID_SHARENR },
{ "file:///path/to/share.123?share=invalid", GFSEC_ERR_CONFIG_INVALID_SHARENR },
{ "file:///path/to/share?share=124",
0, GFSEC_SCHEME_FILE, "", "/path/to/share", 124, 0 },
{ "file:///path/to/share.123?share=124",
0, GFSEC_SCHEME_FILE, "", "/path/to/share.123", 124, 0 },
/* Hash with invalid length. */
{ "file:///path/to/share.123?sha256=", GFSEC_ERR_CONFIG_INVALID_HASH },
@ -103,7 +110,8 @@ struct test tests[] = {
"decafbaddecafLaddecafbaddecafbaddecafbaddecafbaddecafbaddecafbad",
GFSEC_ERR_CONFIG_INVALID_HASH },
/* Invalid share number in path. */
/* Invalid or missing share number in path. */
{ "file:///path/to/share", GFSEC_ERR_CONFIG_INVALID_URI },
{ "file:///path/to/share.2", GFSEC_ERR_CONFIG_INVALID_URI },
{ "file:///path/to/share.000", GFSEC_ERR_CONFIG_INVALID_URI },
{ "file:///path/to/share.256", GFSEC_ERR_CONFIG_INVALID_URI },

Loading…
Cancel
Save