File: exec_test.go

package info (click to toggle)
packer 1.3.4%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 8,324 kB
  • sloc: python: 619; sh: 557; makefile: 111
file content (24 lines) | stat: -rw-r--r-- 599 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
package docker

import (
	"testing"
)

func TestCleanLine(t *testing.T) {
	cases := []struct {
		input  string
		output string
	}{
		{
			"\x1b[0A\x1b[2K\r8dbd9e392a96: Pulling image (precise) from ubuntu\r\x1b[0B\x1b[1A\x1b[2K\r8dbd9e392a96: Pulling image (precise) from ubuntu, endpoint: https://cdn-registry-1.docker.io/v1/\r\x1b[1B",
			"8dbd9e392a96: Pulling image (precise) from ubuntu, endpoint: https://cdn-registry-1.docker.io/v1/",
		},
	}

	for _, tc := range cases {
		actual := cleanOutputLine(tc.input)
		if actual != tc.output {
			t.Fatalf("bad: %#v %#v", tc.input, actual)
		}
	}
}