@@ -9,7 +9,7 @@ use mozjs::jsval::UndefinedValue;
9
9
use mozjs:: rooted;
10
10
use mozjs:: rust:: { JSEngine , RealmOptions , Runtime , SIMPLE_GLOBAL_CLASS } ;
11
11
use mozjs:: typedarray;
12
- use mozjs:: typedarray:: { CreateWith , Float32Array , Uint32Array } ;
12
+ use mozjs:: typedarray:: { BigInt64Array , CreateWith , Float32Array , Uint32Array } ;
13
13
14
14
#[ test]
15
15
fn typedarray ( ) {
@@ -97,5 +97,15 @@ fn typedarray() {
97
97
typedarray ! ( in( context) let mut array: Float32Array = rval. get( ) ) ;
98
98
array. as_mut ( ) . unwrap ( ) . update ( & [ 0.5 , 1.0 , 2.0 ] ) ;
99
99
assert_eq ! ( array. unwrap( ) . as_slice( ) , & [ 0.5 , 1.0 , 2.0 , 2.0 , 4.0 ] ) ;
100
+
101
+ rooted ! ( in( context) let mut rval = ptr:: null_mut:: <JSObject >( ) ) ;
102
+ assert ! ( BigInt64Array :: create( context, CreateWith :: Slice ( & [ -6 , -1 , 0 , 2 , 5 ] ) , rval. handle_mut( ) ) . is_ok( ) ) ;
103
+
104
+ typedarray ! ( in( context) let array: BigInt64Array = rval. get( ) ) ;
105
+ assert_eq ! ( array. unwrap( ) . as_slice( ) , & [ -6 , -1 , 0 , 2 , 5 ] ) ;
106
+
107
+ typedarray ! ( in( context) let mut array: BigInt64Array = rval. get( ) ) ;
108
+ array. as_mut ( ) . unwrap ( ) . update ( & [ -12 , -2 , -1 ] ) ;
109
+ assert_eq ! ( array. unwrap( ) . as_slice( ) , & [ -12 , -2 , -1 , 2 , 5 ] ) ;
100
110
}
101
111
}
0 commit comments