#1260: Added tests for Finalizer.
diff --git a/LanguageFeatures/FinalizationRegistry/Finalizer/attach_A01_t01.dart b/LanguageFeatures/FinalizationRegistry/Finalizer/attach_A01_t01.dart
index 7eb59ed..8bcda2d 100644
--- a/LanguageFeatures/FinalizationRegistry/Finalizer/attach_A01_t01.dart
+++ b/LanguageFeatures/FinalizationRegistry/Finalizer/attach_A01_t01.dart
@@ -21,7 +21,7 @@
 import "../gc_utils_lib.dart";
 import "../../../Utils/expect.dart";
 
-class A{}
+class A {}
 Object? returnedToken;
 int cnt = 0;
 
diff --git a/LanguageFeatures/FinalizationRegistry/Finalizer/attach_A01_t02.dart b/LanguageFeatures/FinalizationRegistry/Finalizer/attach_A01_t02.dart
index a0051bb..b25b312 100644
--- a/LanguageFeatures/FinalizationRegistry/Finalizer/attach_A01_t02.dart
+++ b/LanguageFeatures/FinalizationRegistry/Finalizer/attach_A01_t02.dart
@@ -20,7 +20,7 @@
 import "../gc_utils_lib.dart";
 import "../../../Utils/expect.dart";
 
-class A{}
+class A {}
 
 int cnt = 0;
 final Finalizer finalizer = Finalizer((token) {
diff --git a/LanguageFeatures/FinalizationRegistry/Finalizer/attach_A01_t03.dart b/LanguageFeatures/FinalizationRegistry/Finalizer/attach_A01_t03.dart
index 7c943a8..9045653 100644
--- a/LanguageFeatures/FinalizationRegistry/Finalizer/attach_A01_t03.dart
+++ b/LanguageFeatures/FinalizationRegistry/Finalizer/attach_A01_t03.dart
@@ -21,7 +21,7 @@
 import "../gc_utils_lib.dart";
 import "../../../Utils/expect.dart";
 
-class A{}
+class A {}
 Object? returnedToken;
 int cnt = 0;
 
diff --git a/LanguageFeatures/FinalizationRegistry/Finalizer/attach_A01_t04.dart b/LanguageFeatures/FinalizationRegistry/Finalizer/attach_A01_t04.dart
index c1460d4..3e53950 100644
--- a/LanguageFeatures/FinalizationRegistry/Finalizer/attach_A01_t04.dart
+++ b/LanguageFeatures/FinalizationRegistry/Finalizer/attach_A01_t04.dart
@@ -20,7 +20,7 @@
 import "../gc_utils_lib.dart";
 import "../../../Utils/expect.dart";
 
-class A{}
+class A {}
 
 int cnt = 0;
 final Finalizer<Object> finalizer = Finalizer((token) {
diff --git a/LanguageFeatures/FinalizationRegistry/Finalizer/attach_A02_t01.dart b/LanguageFeatures/FinalizationRegistry/Finalizer/attach_A02_t01.dart
index 8c88ee2..64c5a6d 100644
--- a/LanguageFeatures/FinalizationRegistry/Finalizer/attach_A02_t01.dart
+++ b/LanguageFeatures/FinalizationRegistry/Finalizer/attach_A02_t01.dart
@@ -2,16 +2,9 @@
 // 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 void attach(
-///    Object value,
-///    T finalizationToken,
-///    {Object? detach}
-/// )
-/// Attaches this finalizer to [value].
-///
-/// When [value] is longer accessible to the program, while still having an
-/// attachement to this finalizer, the [callback] of this finalizer may be
-/// called with [finalizationToken] as argument.
+/// @assertion When [value] is longer accessible to the program, while still
+/// having an attachement to this finalizer, the [callback] of this finalizer
+/// may be called with [finalizationToken] as argument.
 ///
 /// @description Checks that callback function cannot be called while
 /// finalization token is still accessible.
@@ -20,8 +13,6 @@
 import "../gc_utils_lib.dart";
 import "../../../Utils/expect.dart";
 
-class A{}
-
 bool called = false;
 final Finalizer finalizer = Finalizer((_) {
   called = true;
diff --git a/LanguageFeatures/FinalizationRegistry/Finalizer/attach_A02_t02.dart b/LanguageFeatures/FinalizationRegistry/Finalizer/attach_A02_t02.dart
index b3d2585..3fd8c24 100644
--- a/LanguageFeatures/FinalizationRegistry/Finalizer/attach_A02_t02.dart
+++ b/LanguageFeatures/FinalizationRegistry/Finalizer/attach_A02_t02.dart
@@ -2,26 +2,17 @@
 // 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 void attach(
-///    Object value,
-///    T finalizationToken,
-///    {Object? detach}
-/// )
-/// Attaches this finalizer to [value].
+/// @assertion When [value] is longer accessible to the program, while still
+/// having an attachement to this finalizer, the [callback] of this finalizer
+/// may be called with [finalizationToken] as argument.
 ///
-/// When [value] is longer accessible to the program, while still having an
-/// attachement to this finalizer, the [callback] of this finalizer may be
-/// called with [finalizationToken] as argument.
-///
-/// @description Checks that callback function cannot be called only once when
-/// finalization token is unaccessible.
+/// @description Checks that callback function can be called only once when
+/// given object is inaccessible.
 /// @author iarkh@unipro.ru
 
 import "../gc_utils_lib.dart";
 import "../../../Utils/expect.dart";
 
-class A{}
-
 int called = 0;
 final Finalizer finalizer = Finalizer((_) {
   called++;
@@ -40,7 +31,7 @@
   value = 12345;
 
   // Initial object is not accessible anymore.
-  // Do something, call triggerGC sevewral times and check that callback is
+  // Do something, call triggerGC several times and check that callback was
   // called only once during the execution.
   test(value);
   triggerGcWithDelay();
diff --git a/LanguageFeatures/FinalizationRegistry/Finalizer/attach_A03_t01.dart b/LanguageFeatures/FinalizationRegistry/Finalizer/attach_A03_t01.dart
new file mode 100644
index 0000000..4839193
--- /dev/null
+++ b/LanguageFeatures/FinalizationRegistry/Finalizer/attach_A03_t01.dart
@@ -0,0 +1,49 @@
+// 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 If a non-null detach value is provided, that object can be passed
+/// to Finalizer.detach to remove the attachment again.
+///
+/// @description Checks that if detach token was passed to [attach], given
+/// object can be detached from the finalizer using [detach].
+/// @author iarkh@unipro.ru
+
+import "../gc_utils_lib.dart";
+import "../../../Utils/expect.dart";
+
+class A {}
+
+int called = 0;
+final Finalizer finalizer = Finalizer((_) {
+  called++;
+});
+
+void test(Object o) {
+  triggerGcWithDelay();
+}
+
+Object test1(Object obj) => obj;
+
+main() {
+  Object value = Object();
+  Object detachToken = A();
+  finalizer.attach(value, "Finalization token", detach: detachToken);
+  print(value);
+  finalizer.detach(detachToken);
+
+  value = 12345;
+
+  // Initial object is not accessible anymore.
+  // Do something, call triggerGC several times and check that callback was
+  // not called during the execution.
+  test(value);
+  triggerGcWithDelay();
+
+  var value1 = test1(value);
+  triggerGcWithDelay();
+  triggerGcWithDelay();
+  triggerGcWithDelay();
+
+  Expect.equals(0, called);
+}
diff --git a/LanguageFeatures/FinalizationRegistry/Finalizer/attach_A03_t02.dart b/LanguageFeatures/FinalizationRegistry/Finalizer/attach_A03_t02.dart
new file mode 100644
index 0000000..d3ba8f9
--- /dev/null
+++ b/LanguageFeatures/FinalizationRegistry/Finalizer/attach_A03_t02.dart
@@ -0,0 +1,29 @@
+// 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 If a non-null detach value is provided, that object can be passed
+/// to Finalizer.detach to remove the attachment again.
+///
+/// @description Checks that nothing happens if detach token is [null].
+/// @author iarkh@unipro.ru
+
+import "../gc_utils_lib.dart";
+import "../../../Utils/expect.dart";
+
+class A {}
+
+int cnt = 0;
+final Finalizer<Object> finalizer = Finalizer((token) {
+  cnt++;
+});
+
+main() {
+  A detachToken = A();
+  {
+    Object value = Object();
+    finalizer.attach(value, "Finalization token", detach: null);
+  }
+  triggerGcWithDelay();
+  Expect.equals(1, cnt);
+}