Test for #48322

Change-Id: I878a288ac5932de8c83546df91038dcf54cd9039
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231845
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
diff --git a/tests/corelib/null_closurized_method_tostring_test.dart b/tests/corelib/null_closurized_method_tostring_test.dart
new file mode 100644
index 0000000..e7439d8
--- /dev/null
+++ b/tests/corelib/null_closurized_method_tostring_test.dart
@@ -0,0 +1,18 @@
+// Copyright (c) 2022, 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.
+
+import "package:expect/expect.dart";
+
+// The closurized methods of `null` have working `toString()` methods.
+// See #48322.
+
+void main() {
+  check(null.toString);
+  check(null.noSuchMethod);
+}
+
+void check(Object o) {
+  final s = o.toString();
+  Expect.notEquals("", s);
+}
diff --git a/tests/corelib_2/null_closurized_method_tostring_test.dart b/tests/corelib_2/null_closurized_method_tostring_test.dart
new file mode 100644
index 0000000..e7439d8
--- /dev/null
+++ b/tests/corelib_2/null_closurized_method_tostring_test.dart
@@ -0,0 +1,18 @@
+// Copyright (c) 2022, 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.
+
+import "package:expect/expect.dart";
+
+// The closurized methods of `null` have working `toString()` methods.
+// See #48322.
+
+void main() {
+  check(null.toString);
+  check(null.noSuchMethod);
+}
+
+void check(Object o) {
+  final s = o.toString();
+  Expect.notEquals("", s);
+}