@@ -9,7 +9,7 @@ use mozjs::jsval::UndefinedValue;
99use mozjs:: rooted;
1010use mozjs:: rust:: { JSEngine , RealmOptions , Runtime , SIMPLE_GLOBAL_CLASS } ;
1111use mozjs:: typedarray;
12- use mozjs:: typedarray:: { CreateWith , Float32Array , Uint32Array } ;
12+ use mozjs:: typedarray:: { BigInt64Array , CreateWith , Float32Array , Uint32Array } ;
1313
1414#[ test]
1515fn typedarray ( ) {
@@ -97,5 +97,15 @@ fn typedarray() {
9797 typedarray ! ( in( context) let mut array: Float32Array = rval. get( ) ) ;
9898 array. as_mut ( ) . unwrap ( ) . update ( & [ 0.5 , 1.0 , 2.0 ] ) ;
9999 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 ] ) ;
100110 }
101111}
0 commit comments