MCPcopy Index your code
hub / github.com/dagger/dagger / TestLexicalRelativePath

Function TestLexicalRelativePath

engine/client/pathutil/pathutil_test.go:9–91  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func TestLexicalRelativePath(t *testing.T) {
10 tests := []struct {
11 name string
12 cwdPath string
13 modPath string
14 expected string
15 wantErr bool
16 }{
17 {
18 name: "Simple relative path",
19 cwdPath: "/home/user",
20 modPath: "/home/user/project",
21 expected: "project",
22 },
23 {
24 name: "Parent directory",
25 cwdPath: "/home/user/project",
26 modPath: "/home/user",
27 expected: "..",
28 },
29 {
30 name: "Same directory",
31 cwdPath: "/home/user",
32 modPath: "/home/user",
33 expected: ".",
34 },
35 {
36 name: "Auth Sock",
37 cwdPath: "/Users/user/project",
38 modPath: "/Users/user/.ssh/auth.sock",
39 expected: "../.ssh/auth.sock",
40 },
41 {
42 name: "Auth Sock",
43 cwdPath: "/Users/user/project",
44 modPath: "/Users/user/./.1password/agent.sock",
45 expected: "../.1password/agent.sock",
46 },
47 {
48 name: "Windows style paths",
49 cwdPath: `C:\Users\user`,
50 modPath: `C:\Users\user\project`,
51 expected: "project",
52 },
53 {
54 name: "Windows different drives",
55 cwdPath: `C:\Users\user`,
56 modPath: `D:\Projects\myproject`,
57 wantErr: true,
58 },
59 {
60 name: "Windows UNC paths",
61 cwdPath: `\\server\share\folder`,
62 modPath: `\\server\share\folder\project`,
63 expected: "project",
64 },
65 {
66 name: "Mixed slashes",

Callers

nothing calls this directly

Calls 4

LexicalRelativePathFunction · 0.85
RunMethod · 0.65
EqualMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected