aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJukka Jylänki <jujjyl@gmail.com>2013-02-01 23:13:17 +0200
committerJukka Jylänki <jujjyl@gmail.com>2013-02-01 23:13:17 +0200
commitff8c8fd1ba0ab0d49029b09f0c083cf47554da56 (patch)
treeadd32cb59563046703d1d1824217807e2e2a998b /tests
parent9dd7e94ecd16a6b4200a276880f378c3e155c212 (diff)
Add a unit test that checks that user is able to specify a custom -std= flag on the command line.
Diffstat (limited to 'tests')
-rw-r--r--tests/hello_cxx11.cpp10
-rwxr-xr-xtests/runner.py6
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/hello_cxx11.cpp b/tests/hello_cxx11.cpp
new file mode 100644
index 00000000..cfce039a
--- /dev/null
+++ b/tests/hello_cxx11.cpp
@@ -0,0 +1,10 @@
+#include <stdio.h>
+
+#if __cplusplus != 201103L
+#error This file should be compiled with -std=c++11!
+#endif
+
+int main( int argc, const char *argv[] ) {
+ printf("Hello world!\\n");
+ return 0;
+}
diff --git a/tests/runner.py b/tests/runner.py
index 43a14e7f..c67b4f24 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -8412,6 +8412,12 @@ f.close()
process.communicate()
assert process.returncode is 0, 'By default, emscripten should build using -std=c++03!'
+ def test_cxx11(self):
+ for compiler in [EMCC, EMXX]:
+ process = Popen([PYTHON, compiler, '-std=c++11', path_from_root('tests', 'hello_cxx11.cpp')], stdout=PIPE, stderr=PIPE)
+ process.communicate()
+ assert process.returncode is 0, 'User should be able to specify custom -std= on the command line!'
+
def test_Os(self):
for opt in ['s', '0']:
output = Popen([PYTHON, EMCC, path_from_root('tests', 'hello_world.c'), '-O' + opt], stdout=PIPE, stderr=PIPE).communicate()