Path: blob/main/test/browser_test_hello_world.c
4128 views
/*1* Copyright 2015 The Emscripten Authors. All rights reserved.2* Emscripten is available under two separate licenses, the MIT license and the3* University of Illinois/NCSA Open Source License. Both these licenses can be4* found in the LICENSE file.5*/67#include <stdio.h>89#include <emscripten.h>1011int main() {12EM_ASM({13Module['prints'] = [];1415var real = out;1617out = function(x) {18real(x);19Module['prints'].push(x);20}21});22printf("hello, world!\n");23EM_ASM({24if (Module['prints'].length !== 1) throw 'bad length ' + Module['prints'].length;25if (Module['prints'][0] !== 'hello, world!') throw 'bad contents: ' + Module['prints'][0];26});27#ifdef REPORT_RESULT28REPORT_RESULT(0);29#endif30return 0;31}32333435