From b03fa373a1073b7902fcbb022d5497b2752e4119 Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Mon, 9 Jun 2014 10:51:10 +0100 Subject: [PATCH] [thin_delta] Print usage on unrecognised switch --- features/thin_delta.feature | 4 ++++ thin-provisioning/thin_delta.cc | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/features/thin_delta.feature b/features/thin_delta.feature index 249d4a6..2bfe0db 100644 --- a/features/thin_delta.feature +++ b/features/thin_delta.feature @@ -27,3 +27,7 @@ Feature: thin_delta {-h|--help} {-V|--version} """ + + Scenario: Unrecognised option should cause failure + When I run `thin_delta --unleash-the-hedeghogs` + Then it should fail diff --git a/thin-provisioning/thin_delta.cc b/thin-provisioning/thin_delta.cc index 969b714..0c4299e 100644 --- a/thin-provisioning/thin_delta.cc +++ b/thin-provisioning/thin_delta.cc @@ -37,6 +37,10 @@ int main(int argc, char **argv) case 'V': cout << THIN_PROVISIONING_TOOLS_VERSION << endl; return 0; + + default: + usage(cerr, basename(argv[0])); + return 1; } }