File: default_windows_test.go

package info (click to toggle)
golang-github-containers-common 0.64.1%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 5,932 kB
  • sloc: makefile: 132; sh: 111
file content (75 lines) | stat: -rw-r--r-- 1,422 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package config

import (
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestGetDefaultMachineVolumes(t *testing.T) {
	for _, tc := range []struct {
		envs   [][]string
		output []string
	}{
		{
			envs: [][]string{
				{"USERPROFILE", "C:\\Users\\test"},
			},
			output: []string{
				"C:\\Users\\test:/Users/test",
				"C:\\:/mnt/c",
			},
		},
		{
			envs: [][]string{
				{"USERPROFILE", "C:\\Users\\test\\AppData\\Local\\Temp\\podman_test123456789"},
			},
			output: []string{
				"C:\\Users\\test\\AppData\\Local\\Temp\\podman_test123456789:/Users/test/AppData/Local/Temp/podman_test123456789",
				"C:\\:/mnt/c",
			},
		},
		{
			envs: [][]string{
				{"USERPROFILE", "D:\\Users\\test"},
			},
			output: []string{
				"D:\\Users\\test:/Users/test",
				"D:\\:/mnt/d",
			},
		},
		{
			envs: [][]string{
				{"USERPROFILE", "c:\\users\\test"},
			},
			output: []string{
				"c:\\users\\test:/users/test",
				"c:\\:/mnt/c",
			},
		},
		{
			envs: [][]string{
				{"USERPROFILE", "C:/Users/test"},
			},
			output: []string{
				"C:/Users/test:/Users/test",
				"C:\\:/mnt/c",
			},
		},
		{
			envs: [][]string{
				{"USERPROFILE", "C:\\Users\\test\\"},
			},
			output: []string{
				"C:\\Users\\test\\:/Users/test/",
				"C:\\:/mnt/c",
			},
		},
	} {
		for _, env := range tc.envs {
			t.Setenv(env[0], env[1])
		}
		output := getDefaultMachineVolumes()
		assert.Equal(t, tc.output, output)
	}
}