forked from terra-farm/go-virtualbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsfolder_test.go
More file actions
38 lines (32 loc) · 829 Bytes
/
sfolder_test.go
File metadata and controls
38 lines (32 loc) · 829 Bytes
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
package virtualbox
import (
"testing"
)
func TestSharedFolderParse(t *testing.T) {
lines := []struct{ key, value string }{
{"SharedFolderNameMachineMapping2", "GGG"},
{"nic2", "hostonly"},
{"nictype2", "virtio"},
{"nicspeed2", "0"},
{"SharedFolderNameMachineMapping1", "Users"},
{"SharedFolderPathMachineMapping1", "/Users"},
{"SharedFolderPathMachineMapping2", "/Users/Guest"},
}
var sf SharedFolders
for _, l := range lines {
if err := sf.parseProperty(l.key, l.value); err != nil {
t.Error("Error parsing line: ", err)
}
}
expected := []SharedFolder{
{"GGG", "/Users/Guest"},
{"Users", "/Users"},
}
list := sf.List()
t.Log("Shared folders:", list)
for i := range expected {
if expected[i] != list[i] {
t.Errorf("Error, different at %d, %v!=%v", i, expected[i], list[i])
}
}
}