| ... | ... | @@ -152,6 +152,108 @@ describe("DesktopShellEnvironment", () => { |
| 152 | 152 | }), |
| 153 | 153 | ); |
| 154 | 154 | |
| 155 | it.effect("hydrates the locale from the login shell on macOS", () => |
| 156 | Effect.gen(function* () { |
| 157 | const env: NodeJS.ProcessEnv = { |
| 158 | SHELL: "/bin/zsh", |
| 159 | PATH: "/usr/bin", |
| 160 | }; |
| 161 | |
| 162 | yield* runShellEnvironment({ |
| 163 | env, |
| 164 | platform: "darwin", |
| 165 | handler: () => |
| 166 | envOutput({ |
| 167 | PATH: "/opt/homebrew/bin:/usr/bin", |
| 168 | LANG: "de_DE.UTF-8", |
| 169 | }), |
| 170 | }); |
| 171 | |
| 172 | assert.equal(env.LANG, "de_DE.UTF-8"); |
| 173 | }), |
| 174 | ); |
| 175 | |
| 176 | it.effect("preserves an inherited locale over the login shell on macOS", () => |
| 177 | Effect.gen(function* () { |
| 178 | const env: NodeJS.ProcessEnv = { |
| 179 | SHELL: "/bin/zsh", |
| 180 | PATH: "/usr/bin", |
| 181 | LANG: "en_US.UTF-8", |
| 182 | }; |
| 183 | |
| 184 | yield* runShellEnvironment({ |
| 185 | env, |
| 186 | platform: "darwin", |
| 187 | handler: () => |
| 188 | envOutput({ |
| 189 | PATH: "/opt/homebrew/bin:/usr/bin", |
| 190 | LANG: "de_DE.UTF-8", |
| 191 | }), |
| 192 | }); |
| 193 | |
| 194 | assert.equal(env.LANG, "en_US.UTF-8"); |
| 195 | }), |
| 196 | ); |
| 197 | |
| 198 | it.effect("does not mix login-shell locale categories into an inherited locale", () => |
| 199 | Effect.gen(function* () { |
| 200 | const env: NodeJS.ProcessEnv = { |
| 201 | SHELL: "/bin/zsh", |
| 202 | PATH: "/usr/bin", |
| 203 | LANG: "en_US.UTF-8", |
| 204 | }; |
| 205 | |
| 206 | yield* runShellEnvironment({ |
| 207 | env, |
| 208 | platform: "darwin", |
| 209 | handler: () => |
| 210 | envOutput({ |
| 211 | PATH: "/opt/homebrew/bin:/usr/bin", |
| 212 | LC_ALL: "de_DE.UTF-8", |
| 213 | }), |
| 214 | }); |
| 215 | |
| 216 | assert.equal(env.LANG, "en_US.UTF-8"); |
| 217 | assert.equal(env.LC_ALL, undefined); |
| 218 | }), |
| 219 | ); |
| 220 | |
| 221 | it.effect("falls back to a UTF-8 LC_CTYPE when no locale is available on macOS", () => |
| 222 | Effect.gen(function* () { |
| 223 | const env: NodeJS.ProcessEnv = { |
| 224 | SHELL: "/bin/zsh", |
| 225 | PATH: "/usr/bin", |
| 226 | }; |
| 227 | |
| 228 | yield* runShellEnvironment({ |
| 229 | env, |
| 230 | platform: "darwin", |
| 231 | handler: () => envOutput({ PATH: "/opt/homebrew/bin:/usr/bin" }), |
| 232 | }); |
| 233 | |
| 234 | assert.equal(env.LANG, undefined); |
| 235 | assert.equal(env.LC_ALL, undefined); |
| 236 | assert.equal(env.LC_CTYPE, "en_US.UTF-8"); |
| 237 | }), |
| 238 | ); |
| 239 | |
| 240 | it.effect("does not apply the locale fallback on linux", () => |
| 241 | Effect.gen(function* () { |
| 242 | const env: NodeJS.ProcessEnv = { |
| 243 | SHELL: "/bin/zsh", |
| 244 | PATH: "/usr/bin", |
| 245 | }; |
| 246 | |
| 247 | yield* runShellEnvironment({ |
| 248 | env, |
| 249 | platform: "linux", |
| 250 | handler: () => envOutput({ PATH: "/home/linuxbrew/.linuxbrew/bin:/usr/bin" }), |
| 251 | }); |
| 252 | |
| 253 | assert.equal(env.LANG, undefined); |
| 254 | }), |
| 255 | ); |
| 256 | |
| 155 | 257 | it.effect("hydrates PATH and missing SSH_AUTH_SOCK from the login shell on linux", () => |
| 156 | 258 | Effect.gen(function* () { |
| 157 | 259 | const env: NodeJS.ProcessEnv = { |