File: change_test.go

package info (click to toggle)
golang-github-fsouza-go-dockerclient 1.6.6-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,204 kB
  • sloc: makefile: 23
file content (29 lines) | stat: -rw-r--r-- 781 bytes parent folder | download | duplicates (3)
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
// Copyright 2014 go-dockerclient authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package docker

import "testing"

func TestChangeString(t *testing.T) {
	t.Parallel()
	tests := []struct {
		change   Change
		expected string
	}{
		{Change{"/etc/passwd", ChangeModify}, "C /etc/passwd"},
		{Change{"/etc/passwd", ChangeAdd}, "A /etc/passwd"},
		{Change{"/etc/passwd", ChangeDelete}, "D /etc/passwd"},
		{Change{"/etc/passwd", 33}, " /etc/passwd"},
	}
	for _, tt := range tests {
		test := tt
		t.Run(test.expected, func(t *testing.T) {
			t.Parallel()
			if got := test.change.String(); got != test.expected {
				t.Errorf("Change.String(): want %q. Got %q.", test.expected, got)
			}
		})
	}
}