Debian Codegraph @

breakup_test.go

raw symbols SCIP
1 // Copyright 2013 Google Inc. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package getopt
6
7 import (
8 "testing"
9 )
10
11 var breakupTests = []struct {
12 in string
13 max int
14 out []string
15 }{
16 {"", 8, []string{}},
17 {"a fox", 8, []string{"a fox"}},
18 {"a foxhound is sly", 2, []string{"a", "foxhound", "is", "sly"}},
19 {"a foxhound is sly", 5, []string{"a", "foxhound", "is", "sly"}},
20 {"a foxhound is sly", 6, []string{"a", "foxhound", "is sly"}},
21 {"a foxhound is sly", 7, []string{"a", "foxhound", "is sly"}},
22 {"a foxhound is sly", 8, []string{"a", "foxhound", "is sly"}},
23 {"a foxhound is sly", 9, []string{"a", "foxhound", "is sly"}},
24 {"a foxhound is sly", 10, []string{"a foxhound", "is sly"}},
25 }
26
27 func TestBreakup(t *testing.T) {
28 for x, tt := range breakupTests {
29 out := breakup(tt.in, tt.max)
30 if badSlice(out, tt.out) {
31 t.Errorf("#%d: got %v, want %v", x, out, tt.out)
32 }
33 }
34 }