|
7 | 7 | "context" |
8 | 8 | "fmt" |
9 | 9 | "os" |
10 | | - "path/filepath" |
11 | 10 | "strings" |
12 | 11 | "testing" |
13 | 12 | "time" |
@@ -852,29 +851,21 @@ func TestPlanning_PathValues(t *testing.T) { |
852 | 851 | t.Fatalf("failed to get current working directory: %s", err) |
853 | 852 | } |
854 | 853 |
|
855 | | - normalizePath := func(path string) string { |
856 | | - rel, err := filepath.Rel(cwd, path) |
857 | | - if err != nil { |
858 | | - t.Errorf("rel(%s,%s): %s", cwd, path, err) |
859 | | - return path |
860 | | - } |
861 | | - return rel |
862 | | - } |
863 | | - |
| 854 | + // path.cwd should be absolute and all others should be relative, as per documentation. |
864 | 855 | expected := map[string]string{ |
865 | | - "cwd": ".", |
| 856 | + "cwd": cwd, |
866 | 857 | "root": "testdata/sourcebundle/planning/path_values/module", // this is the root module of the component |
867 | 858 | "module": "testdata/sourcebundle/planning/path_values/module", // this is the root module |
868 | 859 | "child_root": "testdata/sourcebundle/planning/path_values/module", // should be the same for all modules |
869 | 860 | "child_module": "testdata/sourcebundle/planning/path_values/module/child", // this is the child module |
870 | 861 | } |
871 | 862 |
|
872 | 863 | actual := map[string]string{ |
873 | | - "cwd": normalizePath(component.PlannedOutputValues[addrs.OutputValue{Name: "cwd"}].AsString()), |
874 | | - "root": normalizePath(component.PlannedOutputValues[addrs.OutputValue{Name: "root"}].AsString()), |
875 | | - "module": normalizePath(component.PlannedOutputValues[addrs.OutputValue{Name: "module"}].AsString()), |
876 | | - "child_root": normalizePath(component.PlannedOutputValues[addrs.OutputValue{Name: "child_root"}].AsString()), |
877 | | - "child_module": normalizePath(component.PlannedOutputValues[addrs.OutputValue{Name: "child_module"}].AsString()), |
| 864 | + "cwd": component.PlannedOutputValues[addrs.OutputValue{Name: "cwd"}].AsString(), |
| 865 | + "root": component.PlannedOutputValues[addrs.OutputValue{Name: "root"}].AsString(), |
| 866 | + "module": component.PlannedOutputValues[addrs.OutputValue{Name: "module"}].AsString(), |
| 867 | + "child_root": component.PlannedOutputValues[addrs.OutputValue{Name: "child_root"}].AsString(), |
| 868 | + "child_module": component.PlannedOutputValues[addrs.OutputValue{Name: "child_module"}].AsString(), |
878 | 869 | } |
879 | 870 |
|
880 | 871 | if cmp.Diff(expected, actual) != "" { |
|
0 commit comments