| 150 | } |
| 151 | |
| 152 | static int |
| 153 | test_cmdline_socket_fns(void) |
| 154 | { |
| 155 | cmdline_parse_ctx_t ctx; |
| 156 | struct cmdline *cl; |
| 157 | |
| 158 | cl = cmdline_stdin_new(NULL, "prompt"); |
| 159 | if (cl != NULL) |
| 160 | goto error; |
| 161 | cl = cmdline_stdin_new(&ctx, NULL); |
| 162 | if (cl != NULL) |
| 163 | goto error; |
| 164 | cl = cmdline_file_new(NULL, "prompt", NULL_INPUT); |
| 165 | if (cl != NULL) |
| 166 | goto error; |
| 167 | cl = cmdline_file_new(&ctx, NULL, NULL_INPUT); |
| 168 | if (cl != NULL) |
| 169 | goto error; |
| 170 | cl = cmdline_file_new(&ctx, "prompt", NULL); |
| 171 | if (cl != NULL) |
| 172 | goto error; |
| 173 | cl = cmdline_file_new(&ctx, "prompt", "-/invalid/~/path"); |
| 174 | if (cl != NULL) { |
| 175 | printf("Error: succeeded in opening invalid file for reading!"); |
| 176 | cmdline_free(cl); |
| 177 | return -1; |
| 178 | } |
| 179 | cl = cmdline_file_new(&ctx, "prompt", NULL_INPUT); |
| 180 | if (cl == NULL) { |
| 181 | printf("Error: failed to open /dev/null for reading!"); |
| 182 | return -1; |
| 183 | } |
| 184 | cmdline_free(cl); |
| 185 | cl = NULL; |
| 186 | |
| 187 | /* void functions */ |
| 188 | cmdline_stdin_exit(NULL); |
| 189 | |
| 190 | return 0; |
| 191 | error: |
| 192 | printf("Error: function accepted null parameter!\n"); |
| 193 | cmdline_free(cl); |
| 194 | return -1; |
| 195 | } |
| 196 | |
| 197 | static int |
| 198 | test_cmdline_fns(void) |
no test coverage detected