aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>2014-06-17 00:09:34 -0700
committerSathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>2014-06-17 00:09:34 -0700
commit65f3054a90a1275f831a595c84e6fbfb070e7aab (patch)
treeafb2002d8aeaa4814248193190333e8c6984f550
parent59fb70c9dbde86edf4d7406a645db0dbb66e0c07 (diff)
Add test case for empty path
Test case credits to wilkie from - https://github.com/kripken/emscripten/issues/2235
-rw-r--r--tests/fs/test_emptyPath.c14
-rw-r--r--tests/fs/test_emptyPath.out2
-rw-r--r--tests/test_core.py6
3 files changed, 22 insertions, 0 deletions
diff --git a/tests/fs/test_emptyPath.c b/tests/fs/test_emptyPath.c
new file mode 100644
index 00000000..27d56ea1
--- /dev/null
+++ b/tests/fs/test_emptyPath.c
@@ -0,0 +1,14 @@
+#include <stdio.h>
+
+int main() {
+ FILE* f1 = fopen("s", "r");
+ if (f1 == NULL) {
+ printf("file 's' not found!\n");
+ }
+
+ FILE* f2 = fopen("", "r");
+ if (f2 == NULL) {
+ printf("file '' not found!\n");
+ }
+ return 0;
+}
diff --git a/tests/fs/test_emptyPath.out b/tests/fs/test_emptyPath.out
new file mode 100644
index 00000000..78352877
--- /dev/null
+++ b/tests/fs/test_emptyPath.out
@@ -0,0 +1,2 @@
+file 's' not found!
+file '' not found!
diff --git a/tests/test_core.py b/tests/test_core.py
index 08e3594e..137e5e4a 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -4348,6 +4348,12 @@ def process(filename):
out = path_from_root('tests', 'fs', 'test_writeFile.out')
self.do_run_from_file(src, out)
+ def test_fs_emptyPath(self):
+ if self.emcc_args is None: return self.skip('requires emcc')
+ src = path_from_root('tests', 'fs', 'test_emptyPath.c')
+ out = path_from_root('tests', 'fs', 'test_emptyPath.out')
+ self.do_run_from_file(src, out)
+
def test_fs_append(self):
if self.emcc_args is None: return self.skip('requires emcc')
src = open(path_from_root('tests', 'fs', 'test_append.c'), 'r').read()