summaryrefslogtreecommitdiff
path: root/vendor/github.com/pborman/getopt/breakup_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/pborman/getopt/breakup_test.go')
-rw-r--r--vendor/github.com/pborman/getopt/breakup_test.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/vendor/github.com/pborman/getopt/breakup_test.go b/vendor/github.com/pborman/getopt/breakup_test.go
new file mode 100644
index 0000000..c0ac148
--- /dev/null
+++ b/vendor/github.com/pborman/getopt/breakup_test.go
@@ -0,0 +1,34 @@
+// Copyright 2013 Google Inc. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package getopt
+
+import (
+ "testing"
+)
+
+var breakupTests = []struct {
+ in string
+ max int
+ out []string
+}{
+ {"", 8, []string{}},
+ {"a fox", 8, []string{"a fox"}},
+ {"a foxhound is sly", 2, []string{"a", "foxhound", "is", "sly"}},
+ {"a foxhound is sly", 5, []string{"a", "foxhound", "is", "sly"}},
+ {"a foxhound is sly", 6, []string{"a", "foxhound", "is sly"}},
+ {"a foxhound is sly", 7, []string{"a", "foxhound", "is sly"}},
+ {"a foxhound is sly", 8, []string{"a", "foxhound", "is sly"}},
+ {"a foxhound is sly", 9, []string{"a", "foxhound", "is sly"}},
+ {"a foxhound is sly", 10, []string{"a foxhound", "is sly"}},
+}
+
+func TestBreakup(t *testing.T) {
+ for x, tt := range breakupTests {
+ out := breakup(tt.in, tt.max)
+ if badSlice(out, tt.out) {
+ t.Errorf("#%d: got %v, want %v", x, out, tt.out)
+ }
+ }
+}