Skip to content

Commit

Permalink
Added test emscripten-core#2
Browse files Browse the repository at this point in the history
  • Loading branch information
jaikanthjay46 committed Nov 3, 2019
1 parent 28c60c6 commit fbcc733
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tests/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -9876,8 +9876,14 @@ def test_emranlib(self):
output = run_process([shared.LLVM_NM, '--print-armap', 'liba.a'], stdout=PIPE).stdout
self.assertContained('Archive map', output)

def test_piping_stdin(self):
def test_preprocess_stdin(self):
create_test_file('temp.h', '#include <string>')
outputEcho = run_process([PYTHON, EMCC, '-x', 'cpp-output', '-dM', '-E', '-'], input="#include <string>", stdout=PIPE).stdout
outputFile = run_process([PYTHON, EMCC, '-x', 'cpp-output', '-dM', '-E', 'temp.h'], stdout=PIPE).stdout
self.assertTextDataIdentical(outputEcho, outputFile)
outputStdin = run_process([PYTHON, EMCC, '-x', 'c++', '-dM', '-E', '-'], input="#include <string>", stdout=PIPE).stdout
outputFile = run_process([PYTHON, EMCC, '-x', 'c++', '-dM', '-E', 'temp.h'], stdout=PIPE).stdout
self.assertTextDataIdentical(outputStdin, outputFile)

def test_compile_stdin(self):
with open(path_from_root('tests', 'hello_world.cpp')) as f:
run_process([PYTHON, EMCC, '-x', 'c++', '-'], input=f.read())
for engine in JS_ENGINES:
self.assertContained('hello, world!', run_js('a.out.js', engine=engine))

0 comments on commit fbcc733

Please sign in to comment.