-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1260: Added tests for Finalizer.attach method.
- Loading branch information
Showing
27 changed files
with
456 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,11 +5,10 @@ | |
/// @assertion The value and detach arguments ... Both must be objects supported | ||
/// as an [Expando] key. | ||
/// | ||
/// @description Checks that [value] must be supported as an [Expando] keys. | ||
/// @description Checks that [value] must be supported as an [Expando] key. | ||
/// Test String. | ||
/// @author [email protected] | ||
import "../gc_utils_lib.dart"; | ||
import "../../../Utils/expect.dart"; | ||
|
||
final Finalizer finalizer = Finalizer((_) { throw "Should not reach here"; }); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,11 +5,10 @@ | |
/// @assertion The value and detach arguments ... Both must be objects supported | ||
/// as an [Expando] key. | ||
/// | ||
/// @description Checks that [value] must be supported as an [Expando] keys. | ||
/// @description Checks that [value] must be supported as an [Expando] key. | ||
/// Test numbers. | ||
/// @author [email protected] | ||
import "../gc_utils_lib.dart"; | ||
import "../../../Utils/expect.dart"; | ||
|
||
final Finalizer finalizer = Finalizer((_) { throw "Should not reach here"; }); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,11 +5,10 @@ | |
/// @assertion The value and detach arguments ... Both must be objects supported | ||
/// as an [Expando] key. | ||
/// | ||
/// @description Checks that [value] must be supported as an [Expando] keys. | ||
/// @description Checks that [value] must be supported as an [Expando] key. | ||
/// Test booleans. | ||
/// @author [email protected] | ||
import "../gc_utils_lib.dart"; | ||
import "../../../Utils/expect.dart"; | ||
|
||
final Finalizer finalizer = Finalizer((_) { throw "Should not reach here"; }); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,11 +5,10 @@ | |
/// @assertion The value and detach arguments ... Both must be objects supported | ||
/// as an [Expando] key. | ||
/// | ||
/// @description Checks that [value] must be supported as an [Expando] keys. | ||
/// @description Checks that [value] must be supported as an [Expando] key. | ||
/// Test [Null]. | ||
/// @author [email protected] | ||
import "../gc_utils_lib.dart"; | ||
import "../../../Utils/expect.dart"; | ||
|
||
final Finalizer finalizer = Finalizer((_) { throw "Should not reach here"; }); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
/// @assertion The value and detach arguments ... Both must be objects supported | ||
/// as an [Expando] key. | ||
/// | ||
/// @description Checks that [value] must be supported as an [Expando] keys. | ||
/// @description Checks that [value] must be supported as an [Expando] key. | ||
/// Test Test dart:ffi pointers. | ||
/// @author [email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
/// @assertion The value and detach arguments ... Both must be objects supported | ||
/// as an [Expando] key. | ||
/// | ||
/// @description Checks that [value] must be supported as an [Expando] keys. | ||
/// @description Checks that [value] must be supported as an [Expando] key. | ||
/// Test Test dart:ffi struct. | ||
/// @author [email protected] | ||
|
@@ -22,8 +22,8 @@ class S extends Struct { | |
|
||
main() { | ||
Pointer<S> p = calloc<S>(); | ||
S s = p.ref; | ||
try { | ||
S s = p.ref; | ||
Expect.throws(() { | ||
finalizer.attach(p, "Finalization token"); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
/// @assertion The value and detach arguments ... Both must be objects supported | ||
/// as an [Expando] key. | ||
/// | ||
/// @description Checks that [value] must be supported as an [Expando] keys. | ||
/// @description Checks that [value] must be supported as an [Expando] key. | ||
/// Test Test dart:ffi union. | ||
/// @author [email protected] | ||
|
@@ -24,8 +24,8 @@ class U extends Union { | |
|
||
main() { | ||
Pointer<U> p = calloc<U>(); | ||
U u = p.ref; | ||
try { | ||
U u = p.ref; | ||
Expect.throws(() { | ||
finalizer.attach(u, "Finalization token"); | ||
}); | ||
|
31 changes: 31 additions & 0 deletions
31
LanguageFeatures/FinalizationRegistry/Finalizer/attach_A04_t08.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// 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 The value and detach arguments ... Both must be objects supported | ||
/// as an [Expando] key. | ||
/// | ||
/// @description Checks that detach token must be supported as an [Expando] key. | ||
/// Test String. | ||
/// @author [email protected] | ||
import "../../../Utils/expect.dart"; | ||
|
||
final Finalizer finalizer = Finalizer((_) { throw "Should not reach here"; }); | ||
Object object = Object(); | ||
|
||
main() { | ||
Expect.throws(() { | ||
finalizer.attach(object, "Finalization token", detach: "detachMe"); | ||
}); | ||
|
||
String s = "Just a string"; | ||
Expect.throws(() { | ||
finalizer.attach(object, "Finalization token", detach: s); | ||
}); | ||
|
||
dynamic d = s; | ||
Expect.throws(() { | ||
finalizer.attach(object, "Finalization token", detach: d); | ||
}); | ||
} |
36 changes: 36 additions & 0 deletions
36
LanguageFeatures/FinalizationRegistry/Finalizer/attach_A04_t09.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// 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 The value and detach arguments ... Both must be objects supported | ||
/// as an [Expando] key. | ||
/// | ||
/// @description Checks that detach token must be supported as an [Expando] key. | ||
/// Test numbers. | ||
/// @author [email protected] | ||
import "../../../Utils/expect.dart"; | ||
|
||
final Finalizer finalizer = Finalizer((_) { throw "Should not reach here"; }); | ||
Object object = Object(); | ||
|
||
main() { | ||
Expect.throws(() { | ||
finalizer.attach(object, "Finalization token", detach: 12345); | ||
}); | ||
|
||
var i = 3.14; | ||
Expect.throws(() { | ||
finalizer.attach(object, "Finalization token", detach: i); | ||
}); | ||
|
||
int j = -12934; | ||
Expect.throws(() { | ||
finalizer.attach(object, "Finalization token", detach: j); | ||
}); | ||
|
||
dynamic d = -12.376; | ||
Expect.throws(() { | ||
finalizer.attach(object, "Finalization token", detach: d); | ||
}); | ||
} |
Oops, something went wrong.