Skip to content

Commit

Permalink
Test architecture method errors
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderOMara committed Jan 20, 2025
1 parent a7a7031 commit 2d4f2f3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions macho/universal.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ for (const { kind, arch, file, archs } of fixtures) {
RangeError,
'Offset not found',
);
await assertRejects(
() => uni.architecture(new Architecture()),
RangeError,
'Architecture not found',
);
await assertRejects(
() => uni.architecture(1),
RangeError,
uni.isUniversal() ? 'Offset not found' : 'Architecture not found',
);

if (/\.dylib$|\.framework\//i.test(file)) {
assertEquals(await Universal.typeOf(blob), MH_DYLIB);
Expand Down
2 changes: 1 addition & 1 deletion macho/universal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ export class Universal {
return macho;
}
}
throw new Error('Architecture not found');
throw new RangeError('Architecture not found');
}

/**
Expand Down

0 comments on commit 2d4f2f3

Please sign in to comment.