diff options
| author | Onur Gündüz <ogunduz@gmail.com> | 2026-06-17 03:29:44 +0200 |
|---|---|---|
| committer | Onur Gündüz <ogunduz@gmail.com> | 2026-06-17 03:29:44 +0200 |
| commit | 9a2a61ca289aeee256e104dda807431380eba319 (patch) | |
| tree | ecd3c0f027eafbc18ab59bba4969b0732eeb8b95 /tests/test_cli.c | |
| parent | 917dd2d277476eb7f07d40109f2e160aca36c618 (diff) | |
| download | ffwd-9a2a61ca289aeee256e104dda807431380eba319.tar.gz ffwd-9a2a61ca289aeee256e104dda807431380eba319.zip | |
cli: reject unknown --options instead of treating them as text
Diffstat (limited to 'tests/test_cli.c')
| -rw-r--r-- | tests/test_cli.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_cli.c b/tests/test_cli.c index 8d56f09..7543717 100644 --- a/tests/test_cli.c +++ b/tests/test_cli.c @@ -178,6 +178,16 @@ int main(int argc, char **argv) { for (size_t i = 0; i < sizeof(bad) / sizeof(bad[0]); i++) expect(run_cli(bad[i].args, NULL) == 1, bad[i].what); + /* Unknown --options fail loudly instead of being silently embedded as text + * (guards against typos and removed flags like --backend). A bare -- ends + * option parsing so dash-prefixed text can still be embedded. */ + snprintf(args, sizeof(args), "-d '%s' --backend cuda hi", g_dir); + expect(run_cli(args, NULL) == 1, "unknown --option exits 1"); + expect(file_contains(g_err, "unknown option"), "unknown --option names the flag"); + snprintf(args, sizeof(args), "-d '%s' -- '-dashy text'", g_dir); + expect(run_cli(args, NULL) == 0, "-- terminator allows dash-prefixed text"); + expect(stdout_is_embedding(dims.hidden), "dash text after -- embeds as one input"); + if (g_failures) { fprintf(stderr, "%d CLI check(s) failed\n", g_failures); return 1; |
