Add test that `pub get` works with no $HOME in environment. (#3173)
diff --git a/test/get/with_empty_environment_test.dart b/test/get/with_empty_environment_test.dart
new file mode 100644
index 0000000..0e23034
--- /dev/null
+++ b/test/get/with_empty_environment_test.dart
@@ -0,0 +1,28 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// @dart=2.10
+
+import 'dart:io';
+
+import 'package:test/test.dart';
+
+import '../descriptor.dart' as d;
+import '../test_pub.dart';
+
+void main() {
+ test(r'runs even with an empty environment (eg. no $HOME)', () async {
+ await servePackages((builder) => builder.serve('foo', '1.2.3'));
+
+ await d.appDir({'foo': 'any'}).create();
+
+ await pubGet(environment: {
+ '_PUB_TEST_CONFIG_DIR': null,
+ if (Platform.isWindows) ...{
+ 'SYSTEMROOT': Platform.environment['SYSTEMROOT'],
+ 'TMP': Platform.environment['TMP'],
+ },
+ }, includeParentEnvironment: false);
+ });
+}