MCPcopy
hub / github.com/go-task/task / TestVarInheritance

Function TestVarInheritance

executor_test.go:1043–1109  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1041}
1042
1043func TestVarInheritance(t *testing.T) {
1044 enableExperimentForTest(t, &experiments.EnvPrecedence, 1)
1045 tests := []struct {
1046 name string
1047 call string
1048 }{
1049 {name: "shell"},
1050 {name: "entrypoint-global-dotenv"},
1051 {name: "entrypoint-global-vars"},
1052 // We can't send env vars to a called task, so the env var is not overridden
1053 {name: "entrypoint-task-call-vars"},
1054 // Dotenv doesn't set variables
1055 {name: "entrypoint-task-call-dotenv"},
1056 {name: "entrypoint-task-call-task-vars"},
1057 // Dotenv doesn't set variables
1058 {name: "entrypoint-task-dotenv"},
1059 {name: "entrypoint-task-vars"},
1060 // {
1061 // // Dotenv not currently allowed in included taskfiles
1062 // name: "included-global-dotenv",
1063 // want: "included-global-dotenv\nincluded-global-dotenv\n",
1064 // },
1065 {
1066 name: "included-global-vars",
1067 call: "included",
1068 },
1069 {
1070 // We can't send env vars to a called task, so the env var is not overridden
1071 name: "included-task-call-vars",
1072 call: "included",
1073 },
1074 {
1075 // Dotenv doesn't set variables
1076 // Dotenv not currently allowed in included taskfiles (but doesn't error in a task)
1077 name: "included-task-call-dotenv",
1078 call: "included",
1079 },
1080 {
1081 name: "included-task-call-task-vars",
1082 call: "included",
1083 },
1084 {
1085 // Dotenv doesn't set variables
1086 // Somehow dotenv is working here!
1087 name: "included-task-dotenv",
1088 call: "included",
1089 },
1090 {
1091 name: "included-task-vars",
1092 call: "included",
1093 },
1094 }
1095
1096 t.Setenv("VAR", "shell")
1097 t.Setenv("ENV", "shell")
1098 for _, test := range tests {
1099 NewExecutorTest(t,
1100 WithName(test.name),

Callers

nothing calls this directly

Calls 5

enableExperimentForTestFunction · 0.85
NewExecutorTestFunction · 0.85
WithNameFunction · 0.85
WithExecutorOptionsFunction · 0.85
WithTaskFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…