MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / test_multifile

Method test_multifile

test/test_browser.py:662–700  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

660 self.run_browser('page.html', '/report_result?exit:1')
661
662 def test_multifile(self):
663 # a few files inside a directory
664 ensure_dir('subdirr/moar')
665 create_file('subdirr/data1.txt', '1214141516171819')
666 create_file('subdirr/moar/data2.txt', '3.14159265358979')
667 create_file('main.c', r'''
668 #include <assert.h>
669 #include <stdio.h>
670 #include <string.h>
671 #include <emscripten.h>
672 int main() {
673 char buf[17];
674
675 FILE *f = fopen("subdirr/data1.txt", "r");
676 fread(buf, 1, 16, f);
677 buf[16] = 0;
678 fclose(f);
679 printf("|%s|\n", buf);
680 assert(strcmp("1214141516171819", buf) == 0);
681
682 FILE *f2 = fopen("subdirr/moar/data2.txt", "r");
683 fread(buf, 1, 16, f2);
684 buf[16] = 0;
685 fclose(f2);
686 printf("|%s|\n", buf);
687 assert(strcmp("3.14159265358979", buf) == 0);
688
689 return 0;
690 }
691 ''&#x27;)
692
693 # by individual files
694 self.btest_exit('main.c', cflags=['--preload-file', 'subdirr/data1.txt', '--preload-file', 'subdirr/moar/data2.txt'])
695
696 # by directory, and remove files to make sure
697 self.set_setting('EXIT_RUNTIME')
698 self.compile_btest('main.c', ['--preload-file', 'subdirr', '-o', 'page.html'], reporting=Reporting.JS_ONLY)
699 shutil.rmtree('subdirr')
700 self.run_browser('page.html', '/report_result?exit:0')
701
702 def test_custom_file_package_url(self):
703 # a few files inside a directory

Callers

nothing calls this directly

Calls 6

ensure_dirFunction · 0.90
create_fileFunction · 0.90
btest_exitMethod · 0.80
set_settingMethod · 0.80
compile_btestMethod · 0.80
run_browserMethod · 0.80

Tested by

no test coverage detected