@@ -11,13 +11,14 @@ import {
1111 ExifRational ,
1212 ExifSRational ,
1313} from "./exifUtils.ts" ;
14+ import { withDisposable } from "../__utils__/withDisposable.ts" ;
1415import { HEAPU8 } from "../internal/emscripten.ts" ;
1516import { malloc } from "../internal/stdlib.ts" ;
1617
1718describe ( "ExifRational" , ( ) => {
1819 test ( "setters and getters work correctly" , ( ) => {
1920 const rationalPtr = malloc ( exifFormatGetSize ( "RATIONAL" ) ) ;
20- const exifRational = new ExifRational ( rationalPtr ) ;
21+ const exifRational = withDisposable ( new ExifRational ( rationalPtr ) ) ;
2122 exifRational . numerator = 355 ;
2223 exifRational . denominator = 113 ;
2324 expect ( exifRational ) . toHaveProperty ( "numerator" , 355 ) ;
@@ -28,14 +29,13 @@ describe("ExifRational", () => {
2829 . buffer ,
2930 ) ,
3031 ) . toEqual ( new Uint32Array ( [ 355 , 113 ] ) ) ;
31- exifRational . free ( ) ;
3232 } ) ;
3333} ) ;
3434
3535describe ( "ExifSRational" , ( ) => {
3636 test ( "setters and getters work correctly" , ( ) => {
3737 const sRationalPtr = malloc ( exifFormatGetSize ( "SRATIONAL" ) ) ;
38- const exifSRational = new ExifSRational ( sRationalPtr ) ;
38+ const exifSRational = withDisposable ( new ExifSRational ( sRationalPtr ) ) ;
3939 exifSRational . numerator = - 2147483648 ;
4040 exifSRational . denominator = 524288 ;
4141 expect ( exifSRational ) . toHaveProperty ( "numerator" , - 2147483648 ) ;
@@ -48,7 +48,6 @@ describe("ExifSRational", () => {
4848 ) . buffer ,
4949 ) ,
5050 ) . toEqual ( new Int32Array ( [ - 2147483648 , 524288 ] ) ) ;
51- exifSRational . free ( ) ;
5251 } ) ;
5352} ) ;
5453
@@ -190,10 +189,9 @@ describe("exifGetRational", () => {
190189 it . each ( EXIF_RATIONAL_TABLE ) (
191190 "should return the correct value for buffer $buffer and order $order" ,
192191 ( { buffer, order, expected } ) => {
193- const rational = exifGetRational ( buffer , order ) ;
192+ const rational = withDisposable ( exifGetRational ( buffer , order ) ) ;
194193 expect ( rational . numerator ) . toEqual ( expected . numerator ) ;
195194 expect ( rational . denominator ) . toEqual ( expected . denominator ) ;
196- rational . free ( ) ;
197195 } ,
198196 ) ;
199197} ) ;
@@ -220,10 +218,9 @@ describe("exifGetSRational", () => {
220218 it . each ( EXIF_SRATIONAL_TABLE ) (
221219 "should return the correct value for buffer $buffer and order $order" ,
222220 ( { buffer, order, expected } ) => {
223- const sRational = exifGetSRational ( buffer , order ) ;
221+ const sRational = withDisposable ( exifGetSRational ( buffer , order ) ) ;
224222 expect ( sRational . numerator ) . toEqual ( expected . numerator ) ;
225223 expect ( sRational . denominator ) . toEqual ( expected . denominator ) ;
226- sRational . free ( ) ;
227224 } ,
228225 ) ;
229226} ) ;
0 commit comments