mirror of https://github.com/boa-dev/boa.git
Browse Source
This Pull Request uses the new fallible allocation API in Rust 1.57 to follow the JavaScript specification for data blocks: https://tc39.es/ecma262/#sec-createbytedatablock It changes the following: - Creating a new DataBlock for an ArrayBuffer will no longer fail with an arbitrary byte length, it will now actually call the allocator and try to reserve the needed space, and fail if it can't. - Added sunny and rainy day unit tests that check if the API works as expected. - Bumped the minimum Rust version to Rust 1.57 for the Boa crate. - Removed the unused `DataBlock` implementation in IntegerIndexedObjects.pull/1730/head
Iban Eguia
3 years ago
4 changed files with 42 additions and 42 deletions
@ -0,0 +1,15 @@ |
|||||||
|
use super::*; |
||||||
|
|
||||||
|
#[test] |
||||||
|
fn ut_sunnyy_day_create_byte_data_block() { |
||||||
|
let mut context = Context::new(); |
||||||
|
|
||||||
|
assert!(create_byte_data_block(100, &mut context).is_ok()) |
||||||
|
} |
||||||
|
|
||||||
|
#[test] |
||||||
|
fn ut_rainy_day_create_byte_data_block() { |
||||||
|
let mut context = Context::new(); |
||||||
|
|
||||||
|
assert!(create_byte_data_block(usize::MAX, &mut context).is_err()) |
||||||
|
} |
Loading…
Reference in new issue