forked from Velocidex/velociraptor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathntfs_test.go
31 lines (27 loc) · 849 Bytes
/
ntfs_test.go
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
package paths
import (
"testing"
"github.com/alecthomas/assert"
)
var (
ntfsTestCases = []struct {
path string
components []string
}{{
"C:\\Users\\mike\\server.config.yaml",
[]string{"C:", "Users", "mike", "server.config.yaml"}}, {
"\\\\.\\C:\\Users\\mike\\server.config.yaml",
[]string{"\\\\.\\C:", "Users", "mike", "server.config.yaml"}}, {
"\\\\?\\GLOBALROOT\\Device\\Volume1234\\Users\\mike\\server.config.yaml",
[]string{"\\\\?\\GLOBALROOT\\Device\\Volume1234",
"Users", "mike", "server.config.yaml"}}, {
"C:\\Users\\mike\\你好世界\\你好世界.txt",
[]string{"C:", "Users", "mike", "你好世界", "你好世界.txt"},
}}
)
func TestNTFSPathDetection(t *testing.T) {
for _, testcase := range ntfsTestCases {
assert.Equal(t, testcase.components,
ExtractClientPathComponents(testcase.path))
}
}