Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. diff --git a/tests/test_core.py b/tests/test_core.py
  2. index 0cf3327..c43e5ab 100644
  3. --- a/tests/test_core.py
  4. +++ b/tests/test_core.py
  5. @@ -5574,6 +5574,31 @@ PORT: 3979
  6. self.emcc_args += ['--js-library', path_from_root('tests', 'unicode_library.js')]
  7. self.do_run(open(os.path.join(self.get_dir(), 'main.cpp'), 'r').read(), u'Unicode snowman \u2603 says hello!')
  8.  
  9. + def test_js_library_features(self):
  10. + open(os.path.join(self.get_dir(), 'main.cpp'), 'w').write(r'''
  11. + #include <stdio.h>
  12. + extern "C" {
  13. + extern int countey();
  14. + }
  15. + int main() {
  16. + printf("%d\n", countey());
  17. + printf("%d\n", countey());
  18. + printf("%d\n", countey());
  19. + printf("%d\n", countey());
  20. + printf("%d\n", countey());
  21. + return 0;
  22. + }
  23. + ''')
  24. + open(os.path.join(self.get_dir(), 'mylib.js'), 'w').write('''
  25. + mergeInto(LibraryManager.library, {
  26. + // code provided in a string is emitted directly; this lets us do a closure in a simple way
  27. + countey: '(function() { var counter = 0; return function() { return counter++ }; })()',
  28. + });
  29. + ''')
  30. +
  31. + self.emcc_args += ['--js-library', os.path.join(self.get_dir(), 'mylib.js')]
  32. + self.do_run(open(os.path.join(self.get_dir(), 'main.cpp'), 'r').read(), '0\n1\n2\n3\n4\n')
  33. +
  34. def test_constglobalunion(self):
  35. self.emcc_args += ['-s', 'EXPORT_ALL=1']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement