#1260: Moved Weak Reference tests to LanguageFeatures/WeakReference directory. Added tests for Finalizer constructor.
diff --git a/LanguageFeatures/FinalizationRegistry/Finalizer/Finalizer_A01_t01.dart b/LanguageFeatures/FinalizationRegistry/Finalizer/Finalizer_A01_t01.dart
new file mode 100644
index 0000000..7612042
--- /dev/null
+++ b/LanguageFeatures/FinalizationRegistry/Finalizer/Finalizer_A01_t01.dart
@@ -0,0 +1,40 @@
+// 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.
+
+/// @assertion Finalizer<T> constructor (Null safety)
+/// Finalizer<T>(void callback(T))
+/// Creates a finalizer with the given finalization callback.
+///
+/// The callback is bound to the current zone when the [Finalizer] is created,
+/// and will run in that zone when called.
+///
+/// @description Checks that finalizer object can be created and its callback
+/// will run when attached object becomes inaccessible.
+/// @author iarkh@unipro.ru
+
+import "../gc_utils_lib.dart";
+import "../../../Utils/expect.dart";
+
+int called = 0;
+
+final Finalizer finalizer = Finalizer((_) {
+  called++;
+});
+
+class A {}
+
+void test() {
+  finalizer.attach(A(), null);
+  Expect.equals(0, called);
+}
+
+main() {
+  test();
+  triggerGc();
+  Expect.equals(1, called);
+  triggerGc();
+  Expect.equals(1, called);
+  triggerGc();
+  Expect.equals(1, called);
+}
diff --git a/LanguageFeatures/FinalizationRegistry/Finalizer/Finalizer_A01_t02.dart b/LanguageFeatures/FinalizationRegistry/Finalizer/Finalizer_A01_t02.dart
new file mode 100644
index 0000000..619f039
--- /dev/null
+++ b/LanguageFeatures/FinalizationRegistry/Finalizer/Finalizer_A01_t02.dart
@@ -0,0 +1,34 @@
+// 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.
+
+/// @assertion Finalizer<T> constructor (Null safety)
+/// Finalizer<T>(void callback(T))
+/// Creates a finalizer with the given finalization callback.
+///
+/// The callback is bound to the current zone when the [Finalizer] is created,
+/// and will run in that zone when called.
+///
+/// @description Checks that finalizer object can be created and its callback
+/// will run when attached object becomes inaccessible.
+/// @author iarkh@unipro.ru
+
+import "../gc_utils_lib.dart";
+import "../../../Utils/expect.dart";
+
+int called = 0;
+
+final Finalizer finalizer = Finalizer((_) {
+  called++;
+});
+
+main() {
+  finalizer.attach(Object(), null);
+  Expect.equals(0, called);
+  triggerGc();
+  Expect.equals(1, called);
+  triggerGc();
+  Expect.equals(1, called);
+  triggerGc();
+  Expect.equals(1, called);
+}
diff --git a/LanguageFeatures/FinalizationRegistry/Finalizer/Finalizer_A01_t03.dart b/LanguageFeatures/FinalizationRegistry/Finalizer/Finalizer_A01_t03.dart
new file mode 100644
index 0000000..f2e8867
--- /dev/null
+++ b/LanguageFeatures/FinalizationRegistry/Finalizer/Finalizer_A01_t03.dart
@@ -0,0 +1,44 @@
+// 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.
+
+/// @assertion Finalizer<T> constructor (Null safety)
+/// Finalizer<T>(void callback(T))
+/// Creates a finalizer with the given finalization callback.
+///
+/// The callback is bound to the current zone when the [Finalizer] is created,
+/// and will run in that zone when called.
+///
+/// @description Checks that finalizer object can be created and its callback
+/// will never run if attached object is accessible.
+/// @author iarkh@unipro.ru
+
+import "../gc_utils_lib.dart";
+import "../../../Utils/expect.dart";
+
+int called = 0;
+
+final Finalizer finalizer = Finalizer((_) {
+  called++;
+});
+
+class A {}
+
+main() {
+  A? a = A();
+  finalizer.attach(a, null);
+  Expect.equals(0, called);
+  triggerGc();
+  Expect.equals(0, called);
+  triggerGc();
+  Expect.equals(0, called);
+  triggerGc();
+  Expect.equals(0, called);
+  a = null;
+  triggerGc();
+  Expect.equals(1, called);
+  triggerGc();
+  Expect.equals(1, called);
+  triggerGc();
+  Expect.equals(1, called);
+}
diff --git a/LanguageFeatures/FinalizationRegistry/Finalizer/Finalizer_A01_t04.dart b/LanguageFeatures/FinalizationRegistry/Finalizer/Finalizer_A01_t04.dart
new file mode 100644
index 0000000..4ad69c9
--- /dev/null
+++ b/LanguageFeatures/FinalizationRegistry/Finalizer/Finalizer_A01_t04.dart
@@ -0,0 +1,42 @@
+// 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.
+
+/// @assertion Finalizer<T> constructor (Null safety)
+/// Finalizer<T>(void callback(T))
+/// Creates a finalizer with the given finalization callback.
+///
+/// The callback is bound to the current zone when the [Finalizer] is created,
+/// and will run in that zone when called.
+///
+/// @description Checks that finalizer object can be created and its callback
+/// will never run if attached object is accessible.
+/// @author iarkh@unipro.ru
+
+import "../gc_utils_lib.dart";
+import "../../../Utils/expect.dart";
+
+int called = 0;
+
+final Finalizer finalizer = Finalizer((_) {
+  called++;
+});
+
+test(obj) {
+  finalizer.attach(obj, null);
+  Expect.equals(0, called);
+  triggerGc();
+  Expect.equals(0, called);
+  print(obj);
+}
+
+main() {
+  test(Object());
+  Expect.isTrue(called == 0 || called == 1);
+  triggerGc();
+  Expect.equals(1, called);
+  triggerGc();
+  Expect.equals(1, called);
+  triggerGc();
+  Expect.equals(1, called);
+}
diff --git a/LanguageFeatures/FinalizationRegistry/Finalizer/pubspec.yaml b/LanguageFeatures/FinalizationRegistry/Finalizer/pubspec.yaml
new file mode 100644
index 0000000..9cac0bc
--- /dev/null
+++ b/LanguageFeatures/FinalizationRegistry/Finalizer/pubspec.yaml
@@ -0,0 +1,11 @@
+name: co19_finalization_registry
+description: co19 tests for Dart Finalization Registry feature
+
+# This tests isn't intended for publishing on pub.dev.
+publish_to: none
+
+environment:
+  sdk: '>=2.12.0 <3.0.0'
+
+dependencies:
+  ffi: ^1.0.0
\ No newline at end of file
diff --git a/LanguageFeatures/FinalizationRegistry/expando_key_t01.dart b/LanguageFeatures/FinalizationRegistry/WeakReference/expando_key_t01.dart
similarity index 95%
rename from LanguageFeatures/FinalizationRegistry/expando_key_t01.dart
rename to LanguageFeatures/FinalizationRegistry/WeakReference/expando_key_t01.dart
index 8944401..49ff0ed 100644
--- a/LanguageFeatures/FinalizationRegistry/expando_key_t01.dart
+++ b/LanguageFeatures/FinalizationRegistry/WeakReference/expando_key_t01.dart
@@ -11,7 +11,7 @@
 /// @author sgrekhov@unipro.ru
 /// @issue 48264
 
-import "../../Utils/expect.dart";
+import "../../../Utils/expect.dart";
 
 main() {
   Expect.throws(() {
diff --git a/LanguageFeatures/FinalizationRegistry/expando_key_t02.dart b/LanguageFeatures/FinalizationRegistry/WeakReference/expando_key_t02.dart
similarity index 96%
rename from LanguageFeatures/FinalizationRegistry/expando_key_t02.dart
rename to LanguageFeatures/FinalizationRegistry/WeakReference/expando_key_t02.dart
index 6d96d16..50c964f 100644
--- a/LanguageFeatures/FinalizationRegistry/expando_key_t02.dart
+++ b/LanguageFeatures/FinalizationRegistry/WeakReference/expando_key_t02.dart
@@ -11,7 +11,7 @@
 /// @author sgrekhov@unipro.ru
 /// @issue 48264
 
-import "../../Utils/expect.dart";
+import "../../../Utils/expect.dart";
 
 main() {
   Expect.throws(() {
diff --git a/LanguageFeatures/FinalizationRegistry/expando_key_t04.dart b/LanguageFeatures/FinalizationRegistry/WeakReference/expando_key_t04.dart
similarity index 96%
rename from LanguageFeatures/FinalizationRegistry/expando_key_t04.dart
rename to LanguageFeatures/FinalizationRegistry/WeakReference/expando_key_t04.dart
index 590ed93..a32c618 100644
--- a/LanguageFeatures/FinalizationRegistry/expando_key_t04.dart
+++ b/LanguageFeatures/FinalizationRegistry/WeakReference/expando_key_t04.dart
@@ -13,7 +13,7 @@
 
 import "dart:ffi";
 import "package:ffi/ffi.dart";
-import "../../Utils/expect.dart";
+import "../../../Utils/expect.dart";
 
 class S extends Struct {
   @Int32()
diff --git a/LanguageFeatures/FinalizationRegistry/expando_key_t05.dart b/LanguageFeatures/FinalizationRegistry/WeakReference/expando_key_t05.dart
similarity index 96%
rename from LanguageFeatures/FinalizationRegistry/expando_key_t05.dart
rename to LanguageFeatures/FinalizationRegistry/WeakReference/expando_key_t05.dart
index 05416c5..7c05eef 100644
--- a/LanguageFeatures/FinalizationRegistry/expando_key_t05.dart
+++ b/LanguageFeatures/FinalizationRegistry/WeakReference/expando_key_t05.dart
@@ -13,7 +13,7 @@
 
 import "dart:ffi";
 import "package:ffi/ffi.dart";
-import "../../Utils/expect.dart";
+import "../../../Utils/expect.dart";
 
 class U extends Union {
   @Int32()
diff --git a/LanguageFeatures/FinalizationRegistry/expando_key_t06.dart b/LanguageFeatures/FinalizationRegistry/WeakReference/expando_key_t06.dart
similarity index 94%
rename from LanguageFeatures/FinalizationRegistry/expando_key_t06.dart
rename to LanguageFeatures/FinalizationRegistry/WeakReference/expando_key_t06.dart
index e7a7499..f9c17ae 100644
--- a/LanguageFeatures/FinalizationRegistry/expando_key_t06.dart
+++ b/LanguageFeatures/FinalizationRegistry/WeakReference/expando_key_t06.dart
@@ -10,7 +10,7 @@
 /// not supported as an Expando key. Test null.
 /// @author sgrekhov@unipro.ru
 
-import "../../Utils/expect.dart";
+import "../../../Utils/expect.dart";
 
 main() {
   Expect.throws(() {
diff --git a/LanguageFeatures/FinalizationRegistry/weak_reference_target_t01.dart b/LanguageFeatures/FinalizationRegistry/WeakReference/weak_reference_target_t01.dart
similarity index 93%
rename from LanguageFeatures/FinalizationRegistry/weak_reference_target_t01.dart
rename to LanguageFeatures/FinalizationRegistry/WeakReference/weak_reference_target_t01.dart
index 3e0bbcc..59bbaa5 100644
--- a/LanguageFeatures/FinalizationRegistry/weak_reference_target_t01.dart
+++ b/LanguageFeatures/FinalizationRegistry/WeakReference/weak_reference_target_t01.dart
@@ -14,8 +14,8 @@
 /// cleared
 /// @author sgrekhov@unipro.ru
 
-import "gc_utils_lib.dart";
-import "../../Utils/expect.dart";
+import "../gc_utils_lib.dart";
+import "../../../Utils/expect.dart";
 
 class C {
   int id;
diff --git a/LanguageFeatures/FinalizationRegistry/weak_reference_target_t02.dart b/LanguageFeatures/FinalizationRegistry/WeakReference/weak_reference_target_t02.dart
similarity index 93%
rename from LanguageFeatures/FinalizationRegistry/weak_reference_target_t02.dart
rename to LanguageFeatures/FinalizationRegistry/WeakReference/weak_reference_target_t02.dart
index c487816..b8b1b36 100644
--- a/LanguageFeatures/FinalizationRegistry/weak_reference_target_t02.dart
+++ b/LanguageFeatures/FinalizationRegistry/WeakReference/weak_reference_target_t02.dart
@@ -14,8 +14,8 @@
 /// cleared
 /// @author sgrekhov@unipro.ru
 
-import "gc_utils_lib.dart";
-import "../../Utils/expect.dart";
+import "../gc_utils_lib.dart";
+import "../../../Utils/expect.dart";
 
 class C {
   int id;
diff --git a/LanguageFeatures/FinalizationRegistry/weak_reference_target_t03.dart b/LanguageFeatures/FinalizationRegistry/WeakReference/weak_reference_target_t03.dart
similarity index 93%
rename from LanguageFeatures/FinalizationRegistry/weak_reference_target_t03.dart
rename to LanguageFeatures/FinalizationRegistry/WeakReference/weak_reference_target_t03.dart
index 3f5ba47..478dc95 100644
--- a/LanguageFeatures/FinalizationRegistry/weak_reference_target_t03.dart
+++ b/LanguageFeatures/FinalizationRegistry/WeakReference/weak_reference_target_t03.dart
@@ -14,8 +14,8 @@
 /// cleared
 /// @author sgrekhov@unipro.ru
 
-import "gc_utils_lib.dart";
-import "../../Utils/expect.dart";
+import "../gc_utils_lib.dart";
+import "../../../Utils/expect.dart";
 
 class C {
   int id;
diff --git a/LanguageFeatures/FinalizationRegistry/weak_reference_target_t04.dart b/LanguageFeatures/FinalizationRegistry/WeakReference/weak_reference_target_t04.dart
similarity index 93%
rename from LanguageFeatures/FinalizationRegistry/weak_reference_target_t04.dart
rename to LanguageFeatures/FinalizationRegistry/WeakReference/weak_reference_target_t04.dart
index ae3c716..fc145b2 100644
--- a/LanguageFeatures/FinalizationRegistry/weak_reference_target_t04.dart
+++ b/LanguageFeatures/FinalizationRegistry/WeakReference/weak_reference_target_t04.dart
@@ -14,8 +14,8 @@
 /// cleared
 /// @author sgrekhov@unipro.ru
 
-import "gc_utils_lib.dart";
-import "../../Utils/expect.dart";
+import "../gc_utils_lib.dart";
+import "../../../Utils/expect.dart";
 
 class C {
   int id;
diff --git a/LanguageFeatures/FinalizationRegistry/weak_reference_target_t05.dart b/LanguageFeatures/FinalizationRegistry/WeakReference/weak_reference_target_t05.dart
similarity index 94%
rename from LanguageFeatures/FinalizationRegistry/weak_reference_target_t05.dart
rename to LanguageFeatures/FinalizationRegistry/WeakReference/weak_reference_target_t05.dart
index 1ad3027..62cbbea 100644
--- a/LanguageFeatures/FinalizationRegistry/weak_reference_target_t05.dart
+++ b/LanguageFeatures/FinalizationRegistry/WeakReference/weak_reference_target_t05.dart
@@ -15,8 +15,8 @@
 /// @author sgrekhov@unipro.ru
 
 import "dart:async";
-import "gc_utils_lib.dart";
-import "../../Utils/expect.dart";
+import "../gc_utils_lib.dart";
+import "../../../Utils/expect.dart";
 
 class C {
   int id;
diff --git a/LanguageFeatures/FinalizationRegistry/weak_reference_target_t06.dart b/LanguageFeatures/FinalizationRegistry/WeakReference/weak_reference_target_t06.dart
similarity index 94%
rename from LanguageFeatures/FinalizationRegistry/weak_reference_target_t06.dart
rename to LanguageFeatures/FinalizationRegistry/WeakReference/weak_reference_target_t06.dart
index 9fabe93..48a978f 100644
--- a/LanguageFeatures/FinalizationRegistry/weak_reference_target_t06.dart
+++ b/LanguageFeatures/FinalizationRegistry/WeakReference/weak_reference_target_t06.dart
@@ -15,8 +15,8 @@
 /// @author sgrekhov@unipro.ru
 
 import "dart:async";
-import "gc_utils_lib.dart";
-import "../../Utils/expect.dart";
+import "../gc_utils_lib.dart";
+import "../../../Utils/expect.dart";
 
 class C {
   int id;
diff --git a/LanguageFeatures/FinalizationRegistry/weak_reference_target_t07.dart b/LanguageFeatures/FinalizationRegistry/WeakReference/weak_reference_target_t07.dart
similarity index 94%
rename from LanguageFeatures/FinalizationRegistry/weak_reference_target_t07.dart
rename to LanguageFeatures/FinalizationRegistry/WeakReference/weak_reference_target_t07.dart
index 5d8eac9..8aa0742 100644
--- a/LanguageFeatures/FinalizationRegistry/weak_reference_target_t07.dart
+++ b/LanguageFeatures/FinalizationRegistry/WeakReference/weak_reference_target_t07.dart
@@ -14,8 +14,8 @@
 /// cleared
 /// @author sgrekhov@unipro.ru
 
-import "gc_utils_lib.dart";
-import "../../Utils/expect.dart";
+import "../gc_utils_lib.dart";
+import "../../../Utils/expect.dart";
 
 class C {
   int id;
diff --git a/LanguageFeatures/FinalizationRegistry/weak_reference_target_t08.dart b/LanguageFeatures/FinalizationRegistry/WeakReference/weak_reference_target_t08.dart
similarity index 94%
rename from LanguageFeatures/FinalizationRegistry/weak_reference_target_t08.dart
rename to LanguageFeatures/FinalizationRegistry/WeakReference/weak_reference_target_t08.dart
index e946b02..aec6b59 100644
--- a/LanguageFeatures/FinalizationRegistry/weak_reference_target_t08.dart
+++ b/LanguageFeatures/FinalizationRegistry/WeakReference/weak_reference_target_t08.dart
@@ -14,8 +14,8 @@
 /// cleared
 /// @author sgrekhov@unipro.ru
 
-import "gc_utils_lib.dart";
-import "../../Utils/expect.dart";
+import "../gc_utils_lib.dart";
+import "../../../Utils/expect.dart";
 
 class C {
   int id;
diff --git a/LanguageFeatures/FinalizationRegistry/expando_key_t03.dart b/LanguageFeatures/FinalizationRegistry/expando_key_t03.dart
deleted file mode 100644
index 2b1c11a..0000000
--- a/LanguageFeatures/FinalizationRegistry/expando_key_t03.dart
+++ /dev/null
@@ -1,37 +0,0 @@
-// 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.
-
-/// @assertion Not all objects are supported as targets for weak references. The
-/// WeakReference constructor will reject any object that is not supported as an
-/// Expando key.
-///
-/// @description Check that WeakReference constructor rejects any object that is
-/// not supported as an Expando key. Test dart:ffi pointers.
-/// @author sgrekhov@unipro.ru
-/// @issue 48264
-
-import "dart:ffi";
-import "package:ffi/ffi.dart";
-import "../../Utils/expect.dart";
-
-main() {
-  Pointer<Int8> p1 = calloc<Int8>();
-  try {
-    Expect.throws(() {
-      WeakReference wr = WeakReference<Pointer<Int8>>(p1);
-      print(wr.target);
-    });
-  } finally {
-    calloc.free(p1);
-  }
-  Pointer<Int16> p2 = calloc<Int16>();
-  try {
-    Expect.throws(() {
-      WeakReference wr = WeakReference(p2);
-      print(wr.target);
-    });
-  } finally {
-    calloc.free(p2);
-  }
-}