aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authormanuels <manuel.schoelling@gmx.de>2013-05-08 15:24:25 +0200
committermanuels <manuel.schoelling@gmx.de>2013-05-08 15:24:25 +0200
commit4e72ab4bd5cbf987e08d0ca72bef4292e5870d8e (patch)
treeeb429602537cb4a97ee807198d5f76eeb6eb20d8 /tests
parent4ead9dad30c559f0d342c592633d3ad73d8b1bd3 (diff)
Fix bug in rename() that occures if new filename starts with the old filename
Diffstat (limited to 'tests')
-rwxr-xr-xtests/runner.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py
index ead85948..838c150d 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -3402,6 +3402,31 @@ Exiting setjmp function, level: 0, prev_jmp: -1
'''
self.do_run(src, 'z:1*', force_c=True)
+ def test_rename(self):
+ src = '''
+ #include <stdio.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+ #include <assert.h>
+
+ int main() {
+ int err;
+ FILE* fid;
+
+ err = mkdir("/foo", 0777);
+ fid = fopen("/foo/bar", "w+");
+ fclose(fid);
+
+ err = rename("/foo/bar", "/foo/bar2");
+ printf("%d\\n", err);
+
+ err = rename("/foo", "/foo/foo");
+ printf("%d\\n", err);
+ return 0;
+ }
+ '''
+ self.do_run(src, '0\n-1\n', force_c=True)
+
def test_alloca_stack(self):
if self.emcc_args is None: return # too slow in other modes