summaryrefslogtreecommitdiff
path: root/example_test.go
diff options
context:
space:
mode:
authorAlex Flint <[email protected]>2019-05-03 13:07:12 -0700
committerAlex Flint <[email protected]>2019-05-03 13:07:12 -0700
commit3392c173d71a46d4be61c6c0b02c25e37dbd29e2 (patch)
tree71f1ec963f089cce78c211eef7289e3735d48886 /example_test.go
parente2ce620ee44f6ef454c46351883971a213c04f68 (diff)
add expected output for usage example
Diffstat (limited to 'example_test.go')
-rw-r--r--example_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/example_test.go b/example_test.go
index 7ae2df1..72807a7 100644
--- a/example_test.go
+++ b/example_test.go
@@ -115,5 +115,23 @@ func Example_usageString() {
Dataset string `help:"dataset to use"`
Optimize int `arg:"-O,help:optimization level"`
}
+
+ // This is only necessary when running inside golang's runnable example harness
+ osExit = func(int) {}
+
MustParse(&args)
+
+ // output:
+ // Usage: example [--verbose] [--dataset DATASET] [--optimize OPTIMIZE] INPUT [OUTPUT [OUTPUT ...]]
+ //
+ // Positional arguments:
+ // INPUT
+ // OUTPUT
+ //
+ // Options:
+ // --verbose, -v verbosity level
+ // --dataset DATASET dataset to use
+ // --optimize OPTIMIZE, -O OPTIMIZE
+ // optimization level
+ // --help, -h display this help and exit
}