diff options
| author | David M. Syzdek <david@syzdek.net> | 2022-03-17 00:13:25 -0800 |
|---|---|---|
| committer | David M. Syzdek <david@syzdek.net> | 2022-03-17 00:13:25 -0800 |
| commit | 1fc1c6a6963fa20af8a9314f822071e28bb9a318 (patch) | |
| tree | 9b47abe843b053746c22a7f6e4431318688519d8 /tests | |
| parent | 7b39a8de72a20215e9285d824059fa843ae19aed (diff) | |
| download | tinyrad-1fc1c6a6963fa20af8a9314f822071e28bb9a318.tar.gz tinyrad-1fc1c6a6963fa20af8a9314f822071e28bb9a318.tar.bz2 tinyrad-1fc1c6a6963fa20af8a9314f822071e28bb9a318.tar.xz tinyrad-1fc1c6a6963fa20af8a9314f822071e28bb9a318.zip | |
libtinyrad: updating tinyrad_strexpand() to return modified buffer
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test-str-expand.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/tests/test-str-expand.c b/tests/test-str-expand.c index 0a5eb74..44c4816 100644 --- a/tests/test-str-expand.c +++ b/tests/test-str-expand.c | |||
| @@ -133,11 +133,10 @@ main( | |||
| 133 | { | 133 | { |
| 134 | int opt; | 134 | int opt; |
| 135 | int c; | 135 | int c; |
| 136 | int rc; | ||
| 137 | int opt_index; | 136 | int opt_index; |
| 138 | size_t pos; | 137 | size_t pos; |
| 139 | unsigned opts; | 138 | unsigned opts; |
| 140 | char buff[256]; | 139 | char buff[TRAD_LINE_MAX_LEN]; |
| 141 | const MyTestStr * test_str; | 140 | const MyTestStr * test_str; |
| 142 | 141 | ||
| 143 | // getopt options | 142 | // getopt options |
| @@ -219,9 +218,9 @@ main( | |||
| 219 | while (optind < argc) | 218 | while (optind < argc) |
| 220 | { | 219 | { |
| 221 | trutils_verbose(opts, "test string: %s", argv[optind]); | 220 | trutils_verbose(opts, "test string: %s", argv[optind]); |
| 222 | if ((rc = tinyrad_strexpand(buff, argv[optind], sizeof(buff), (((opts&TEST_OPT_FORCE)) ? TRAD_YES : TRAD_NO))) != TRAD_SUCCESS) | 221 | if (!(tinyrad_strexpand(buff, argv[optind], sizeof(buff), (((opts&TEST_OPT_FORCE)) ? TRAD_YES : TRAD_NO)))) |
| 223 | { | 222 | { |
| 224 | trutils_error(opts, NULL, "tinyrad_strexpand(): %s", tinyrad_strerror(rc)); | 223 | trutils_error(opts, NULL, "tinyrad_strexpand(): error occurred"); |
| 225 | return(1); | 224 | return(1); |
| 226 | }; | 225 | }; |
| 227 | buff[sizeof(buff)-1] = '\0'; | 226 | buff[sizeof(buff)-1] = '\0'; |
| @@ -240,9 +239,9 @@ main( | |||
| 240 | { | 239 | { |
| 241 | test_str = &test_strings[pos]; | 240 | test_str = &test_strings[pos]; |
| 242 | trutils_verbose(opts, "test string: %s", test_strings[pos].origin); | 241 | trutils_verbose(opts, "test string: %s", test_strings[pos].origin); |
| 243 | if ((rc = tinyrad_strexpand(buff, test_str->origin, sizeof(buff), (int)test_str->force)) != TRAD_SUCCESS) | 242 | if (!(tinyrad_strexpand(buff, test_str->origin, sizeof(buff), (int)test_str->force))) |
| 244 | { | 243 | { |
| 245 | trutils_error(opts, NULL, "tinyrad_strexpand(): %s", tinyrad_strerror(rc)); | 244 | trutils_error(opts, NULL, "tinyrad_strexpand(): error occurred"); |
| 246 | return(1); | 245 | return(1); |
| 247 | }; | 246 | }; |
| 248 | buff[sizeof(buff)-1] = '\0'; | 247 | buff[sizeof(buff)-1] = '\0'; |
