Skip to content

Commit d7fe11b

Browse files
authored
Add more test for i53abi in JS libraries. NFC (#25919)
Specifically add with and without bigint enabled and with and without wasm64.
1 parent 3dd4889 commit d7fe11b

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

test/runner.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
# randombrowser10 (which runs 10 random tests from 'browser').
9898
misc_test_modes = [
9999
'other',
100+
'jslib',
100101
'browser',
101102
'sanity',
102103
'sockets',

test/test_jslib.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from subprocess import PIPE
88

99
from common import RunnerCore, create_file, read_file, test_file
10-
from decorators import parameterized
10+
from decorators import also_with_wasm64, also_without_bigint, parameterized
1111

1212
from tools.shared import EMCC
1313
from tools.utils import delete_file
@@ -286,8 +286,27 @@ def test_jslib_invalid_decorator(self):
286286
err = self.expect_fail([EMCC, test_file('hello_world.c'), '--js-library', 'lib.js'])
287287
self.assertContained("lib.js: Decorator (jslibfunc__async} has wrong type. Expected 'boolean' not 'string'", err)
288288

289+
@also_with_wasm64
290+
@also_without_bigint
289291
def test_jslib_i53abi(self):
290292
create_file('lib.js', r'''
293+
mergeInto(LibraryManager.library, {
294+
jslibfunc__i53abi: true,
295+
jslibfunc__sig: 'j',
296+
jslibfunc: (x) => { return 42 },
297+
});
298+
''')
299+
create_file('test.c', r'''
300+
#include <stdio.h>
301+
int64_t jslibfunc();
302+
int main() {
303+
printf("main: %lld\n", jslibfunc());
304+
}
305+
''')
306+
self.do_runf('test.c', 'main: 42\n', cflags=['--js-library', 'lib.js'])
307+
308+
def test_jslib_i53abi_errors(self):
309+
create_file('lib.js', r'''
291310
mergeInto(LibraryManager.library, {
292311
jslibfunc__i53abi: true,
293312
jslibfunc: (x) => { return 42 },

0 commit comments

Comments
 (0)