Skip to content

Commit 8abb175

Browse files
authored
[test] Name jslib tests consistently and group together. NFC (emscripten-core#23293)
1 parent 3fcc4d7 commit 8abb175

File tree

8 files changed

+119
-120
lines changed

8 files changed

+119
-120
lines changed

site/source/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ By default, the implementation is added to **library.js** (and this is
373373
where you'll find parts of Emscripten's *libc*). You can put
374374
the JavaScript implementation in your own library file and add it using
375375
the :ref:`emcc option <emcc-js-library>` ``--js-library``. See
376-
`test_js_libraries`_ in **test/test_other.py** for a complete working
376+
`test_jslib`_ in **test/test_other.py** for a complete working
377377
example, including the syntax you should use inside the JavaScript library
378378
file.
379379

@@ -844,7 +844,7 @@ or compile the same binding code to both Node.js native addon and WebAssembly,
844844
you can give it a try. See `Emnapi documentation`_ for more details.
845845

846846
.. _library.js: https://github.com/emscripten-core/emscripten/blob/main/src/library.js
847-
.. _test_js_libraries: https://github.com/emscripten-core/emscripten/blob/1.29.12/tests/test_core.py#L5043
847+
.. _test_jslib: https://github.com/emscripten-core/emscripten/blob/1.29.12/tests/test_core.py#L5043
848848
.. _tools/system_libs.py: https://github.com/emscripten-core/emscripten/blob/main/tools/system_libs.py
849849
.. _library_\*.js: https://github.com/emscripten-core/emscripten/tree/main/src
850850
.. _test_add_function in test/test_core.py: https://github.com/emscripten-core/emscripten/blob/1.29.12/tests/test_core.py#L6237
File renamed without changes.

test/test_core.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6161,13 +6161,12 @@ def test_random_device(self):
61616161
def test_reinterpreted_ptrs(self):
61626162
self.do_core_test('test_reinterpreted_ptrs.cpp')
61636163

6164-
def test_js_libraries(self):
6165-
create_file('main.cpp', '''
6164+
def test_jslib(self):
6165+
create_file('main.c', '''
61666166
#include <stdio.h>
6167-
extern "C" {
6168-
extern void printey();
6169-
extern int calcey(int x, int y);
6170-
}
6167+
void printey();
6168+
int calcey(int x, int y);
6169+
61716170
int main() {
61726171
printey();
61736172
printf("*%d*\\n", calcey(10, 22));
@@ -6186,7 +6185,7 @@ def test_js_libraries(self):
61866185
''')
61876186

61886187
self.emcc_args += ['--js-library', 'mylib1.js', '--js-library', 'mylib2.js']
6189-
self.do_runf('main.cpp', 'hello from lib!\n*32*\n')
6188+
self.do_runf('main.c', 'hello from lib!\n*32*\n')
61906189

61916190
@with_env_modify({'LC_ALL': 'latin-1', 'PYTHONUTF8': '0', 'PYTHONCOERCECLOCALE': '0'})
61926191
@crossplatform
@@ -9536,11 +9535,11 @@ def test_syscall_intercept(self):
95369535
self.do_core_test('test_syscall_intercept.c')
95379536

95389537
@also_with_wasm_bigint
9539-
def test_js_library_i64_params(self):
9538+
def test_jslib_i64_params(self):
95409539
# Tests the defineI64Param and receiveI64ParamAsI53 helpers that are
95419540
# used to recieve i64 argument in syscalls.
9542-
self.emcc_args += ['--js-library=' + test_file('core/js_library_i64_params.js')]
9543-
self.do_core_test('js_library_i64_params.c')
9541+
self.emcc_args += ['--js-library=' + test_file('core/test_jslib_i64_params.js')]
9542+
self.do_core_test('test_jslib_i64_params.c')
95449543

95459544
def test_main_reads_args(self):
95469545
self.run_process([EMCC, '-c', test_file('core/test_main_reads_args_real.c'), '-o', 'real.o'] + self.get_emcc_args(compile_only=True))

0 commit comments

Comments
 (0)