(t *testing.T)
| 76 | } |
| 77 | |
| 78 | func TestComputeDevboxPathIsIdempotent(t *testing.T) { |
| 79 | devbox := devboxForTesting(t) |
| 80 | devbox.nix = &testNix{"/tmp/my/path"} |
| 81 | ctx := t.Context() |
| 82 | env, err := devbox.computeEnv(ctx, false /*use cache*/, devopt.EnvOptions{}) |
| 83 | require.NoError(t, err, "computeEnv should not fail") |
| 84 | path := env["PATH"] |
| 85 | assert.NotEmpty(t, path, "path should not be nil") |
| 86 | |
| 87 | t.Setenv("PATH", path) |
| 88 | t.Setenv(envpath.InitPathEnv, env[envpath.InitPathEnv]) |
| 89 | t.Setenv(envpath.PathStackEnv, env[envpath.PathStackEnv]) |
| 90 | t.Setenv(envpath.Key(devbox.ProjectDirHash()), env[envpath.Key(devbox.ProjectDirHash())]) |
| 91 | |
| 92 | env, err = devbox.computeEnv(ctx, false /*use cache*/, devopt.EnvOptions{}) |
| 93 | require.NoError(t, err, "computeEnv should not fail") |
| 94 | path2 := env["PATH"] |
| 95 | |
| 96 | assert.Equal(t, path, path2, "path should be the same") |
| 97 | } |
| 98 | |
| 99 | func TestComputeDevboxPathWhenRemoving(t *testing.T) { |
| 100 | devbox := devboxForTesting(t) |
nothing calls this directly
no test coverage detected