-
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.
- Loading branch information
Showing
8 changed files
with
234 additions
and
29 deletions.
There are no files selected for viewing
29 changes: 0 additions & 29 deletions
29
LanguageFeatures/FinalizationRegistry/Finalizer/attach_A03_t02.dart
This file was deleted.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
LanguageFeatures/FinalizationRegistry/Finalizer/attach_A04_t01.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,32 @@ | ||
// 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 [value] must be supported as an [Expando] keys. | ||
/// Test String. | ||
/// @author [email protected] | ||
import "../gc_utils_lib.dart"; | ||
import "../../../Utils/expect.dart"; | ||
|
||
final Finalizer finalizer = Finalizer((_) { throw "Should not reach here"; }); | ||
Object detachToken = Object; | ||
|
||
main() { | ||
Expect.throws(() { | ||
finalizer.attach("Shouldn't work", "Finalization token", detach: detachToken); | ||
}); | ||
|
||
String s = "Just a string"; | ||
Expect.throws(() { | ||
finalizer.attach("Shouldn't work", "Finalization token"); | ||
}); | ||
|
||
dynamic d = s; | ||
Expect.throws(() { | ||
finalizer.attach("Shouldn't work", "Finalization token"); | ||
}); | ||
} |
37 changes: 37 additions & 0 deletions
37
LanguageFeatures/FinalizationRegistry/Finalizer/attach_A04_t02.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,37 @@ | ||
// 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 [value] must be supported as an [Expando] keys. | ||
/// Test numbers. | ||
/// @author [email protected] | ||
import "../gc_utils_lib.dart"; | ||
import "../../../Utils/expect.dart"; | ||
|
||
final Finalizer finalizer = Finalizer((_) { throw "Should not reach here"; }); | ||
Object detachToken = Object; | ||
|
||
main() { | ||
Expect.throws(() { | ||
finalizer.attach(12345, "Finalization token", detach: detachToken); | ||
}); | ||
|
||
var i = 3.14; | ||
Expect.throws(() { | ||
finalizer.attach(i, "Finalization token"); | ||
}); | ||
|
||
int j = -12934; | ||
Expect.throws(() { | ||
finalizer.attach(j, "Finalization token"); | ||
}); | ||
|
||
dynamic d = -12.376; | ||
Expect.throws(() { | ||
finalizer.attach(d, "Finalization token"); | ||
}); | ||
} |
37 changes: 37 additions & 0 deletions
37
LanguageFeatures/FinalizationRegistry/Finalizer/attach_A04_t03.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,37 @@ | ||
// 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 [value] must be supported as an [Expando] keys. | ||
/// Test booleans. | ||
/// @author [email protected] | ||
import "../gc_utils_lib.dart"; | ||
import "../../../Utils/expect.dart"; | ||
|
||
final Finalizer finalizer = Finalizer((_) { throw "Should not reach here"; }); | ||
Object detachToken = Object; | ||
|
||
main() { | ||
Expect.throws(() { | ||
finalizer.attach(true, "Finalization token", detach: detachToken); | ||
}); | ||
|
||
var b1 = false; | ||
Expect.throws(() { | ||
finalizer.attach(b1, "Finalization token"); | ||
}); | ||
|
||
bool? b2 = true; | ||
Expect.throws(() { | ||
finalizer.attach(b2, "Finalization token"); | ||
}); | ||
|
||
dynamic b3 = true; | ||
Expect.throws(() { | ||
finalizer.attach(b3, "Finalization token"); | ||
}); | ||
} |
22 changes: 22 additions & 0 deletions
22
LanguageFeatures/FinalizationRegistry/Finalizer/attach_A04_t04.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,22 @@ | ||
// 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 [value] must be supported as an [Expando] keys. | ||
/// Test [Null]. | ||
/// @author [email protected] | ||
import "../gc_utils_lib.dart"; | ||
import "../../../Utils/expect.dart"; | ||
|
||
final Finalizer finalizer = Finalizer((_) { throw "Should not reach here"; }); | ||
|
||
main() { | ||
dynamic d = null; | ||
Expect.throws(() { | ||
finalizer.attach(d, "Finalization token"); | ||
}); | ||
} |
38 changes: 38 additions & 0 deletions
38
LanguageFeatures/FinalizationRegistry/Finalizer/attach_A04_t05.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,38 @@ | ||
// 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 [value] must be supported as an [Expando] keys. | ||
/// Test Test dart:ffi pointers. | ||
/// @author [email protected] | ||
import "dart:ffi"; | ||
import "package:ffi/ffi.dart"; | ||
import "../../../Utils/expect.dart"; | ||
|
||
final Finalizer finalizer = Finalizer((_) { throw "Should not reach here"; }); | ||
Object detachToken = Object; | ||
|
||
main() { | ||
Pointer<Int8> p1 = calloc<Int8>(); | ||
try { | ||
Expect.throws(() { | ||
finalizer.attach(p1, "Finalization token"); | ||
}); | ||
} finally { | ||
calloc.free(p1); | ||
} | ||
|
||
Pointer<Int16> p2 = calloc<Int16>(); | ||
try { | ||
Expect.throws(() { | ||
finalizer.attach(p2, "Finalization token"); | ||
}); | ||
} finally { | ||
calloc.free(p2); | ||
} | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
LanguageFeatures/FinalizationRegistry/Finalizer/attach_A04_t06.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,33 @@ | ||
// 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 [value] must be supported as an [Expando] keys. | ||
/// Test Test dart:ffi struct. | ||
/// @author [email protected] | ||
import "dart:ffi"; | ||
import "package:ffi/ffi.dart"; | ||
import "../../../Utils/expect.dart"; | ||
|
||
final Finalizer finalizer = Finalizer((_) { throw "Should not reach here"; }); | ||
|
||
class S extends Struct { | ||
@Int32() | ||
external int x; | ||
} | ||
|
||
main() { | ||
Pointer<S> p = calloc<S>(); | ||
try { | ||
S s = p.ref; | ||
Expect.throws(() { | ||
finalizer.attach(p, "Finalization token"); | ||
}); | ||
} finally { | ||
calloc.free(p); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
LanguageFeatures/FinalizationRegistry/Finalizer/attach_A04_t067.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,35 @@ | ||
// 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 [value] must be supported as an [Expando] keys. | ||
/// Test Test dart:ffi union. | ||
/// @author [email protected] | ||
import "dart:ffi"; | ||
import "package:ffi/ffi.dart"; | ||
import "../../../Utils/expect.dart"; | ||
|
||
final Finalizer finalizer = Finalizer((_) { throw "Should not reach here"; }); | ||
|
||
class U extends Union { | ||
@Int32() | ||
external int x; | ||
@Int16() | ||
external int y; | ||
} | ||
|
||
main() { | ||
Pointer<U> p = calloc<U>(); | ||
try { | ||
U u = p.ref; | ||
Expect.throws(() { | ||
finalizer.attach(u, "Finalization token"); | ||
}); | ||
} finally { | ||
calloc.free(p); | ||
} | ||
} |