summaryrefslogtreecommitdiffstats
path: root/dependencies/pkg/mod/github.com/jessevdk/go-flags@v1.5.0/long_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'dependencies/pkg/mod/github.com/jessevdk/go-flags@v1.5.0/long_test.go')
-rw-r--r--dependencies/pkg/mod/github.com/jessevdk/go-flags@v1.5.0/long_test.go85
1 files changed, 85 insertions, 0 deletions
diff --git a/dependencies/pkg/mod/github.com/jessevdk/go-flags@v1.5.0/long_test.go b/dependencies/pkg/mod/github.com/jessevdk/go-flags@v1.5.0/long_test.go
new file mode 100644
index 0000000..02fc8c7
--- /dev/null
+++ b/dependencies/pkg/mod/github.com/jessevdk/go-flags@v1.5.0/long_test.go
@@ -0,0 +1,85 @@
+package flags
+
+import (
+ "testing"
+)
+
+func TestLong(t *testing.T) {
+ var opts = struct {
+ Value bool `long:"value"`
+ }{}
+
+ ret := assertParseSuccess(t, &opts, "--value")
+
+ assertStringArray(t, ret, []string{})
+
+ if !opts.Value {
+ t.Errorf("Expected Value to be true")
+ }
+}
+
+func TestLongArg(t *testing.T) {
+ var opts = struct {
+ Value string `long:"value"`
+ }{}
+
+ ret := assertParseSuccess(t, &opts, "--value", "value")
+
+ assertStringArray(t, ret, []string{})
+ assertString(t, opts.Value, "value")
+}
+
+func TestLongArgEqual(t *testing.T) {
+ var opts = struct {
+ Value string `long:"value"`
+ }{}
+
+ ret := assertParseSuccess(t, &opts, "--value=value")
+
+ assertStringArray(t, ret, []string{})
+ assertString(t, opts.Value, "value")
+}
+
+func TestLongDefault(t *testing.T) {
+ var opts = struct {
+ Value string `long:"value" default:"value"`
+ }{}
+
+ ret := assertParseSuccess(t, &opts)
+
+ assertStringArray(t, ret, []string{})
+ assertString(t, opts.Value, "value")
+}
+
+func TestLongOptional(t *testing.T) {
+ var opts = struct {
+ Value string `long:"value" optional:"yes" optional-value:"value"`
+ }{}
+
+ ret := assertParseSuccess(t, &opts, "--value")
+
+ assertStringArray(t, ret, []string{})
+ assertString(t, opts.Value, "value")
+}
+
+func TestLongOptionalArg(t *testing.T) {
+ var opts = struct {
+ Value string `long:"value" optional:"yes" optional-value:"value"`
+ }{}
+
+ ret := assertParseSuccess(t, &opts, "--value", "no")
+
+ assertStringArray(t, ret, []string{"no"})
+ assertString(t, opts.Value, "value")
+}
+
+func TestLongOptionalArgEqual(t *testing.T) {
+ var opts = struct {
+ Value string `long:"value" optional:"yes" optional-value:"value"`
+ }{}
+
+ ret := assertParseSuccess(t, &opts, "--value=value", "no")
+
+ assertStringArray(t, ret, []string{"no"})
+ assertString(t, opts.Value, "value")
+}