File: options_test.go

package info (click to toggle)
golang-github-smallstep-cli-utils 0.12.1%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 448 kB
  • sloc: makefile: 24
file content (32 lines) | stat: -rw-r--r-- 486 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package ui

import "testing"

func TestWithMinLength(t *testing.T) {
	tests := []struct {
		name   string
		length int
	}{
		{
			name:   "negative",
			length: -5,
		},
		{
			name:   "zero",
			length: 0,
		},
		{
			name:   "positive",
			length: 11,
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			o := &options{}
			WithMinLength(tt.length)(o)
			if o.minLength != tt.length {
				t.Errorf("want %v, but got %v", tt.length, o.minLength)
			}
		})
	}
}