about summary refs log tree commit homepage
path: root/test/valid-path-1.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2012-01-11 21:46:04 +0000
committerEric Wong <normalperson@yhbt.net>2012-01-11 21:46:04 +0000
commit301b41b6f1350806a750794d615e3468735757a6 (patch)
tree54deb2b4cb0060a54746e3635746d0f338c294f5 /test/valid-path-1.c
downloadcmogstored-301b41b6f1350806a750794d615e3468735757a6.tar.gz
Nuked old history since it was missing copyright/GPLv3 notices.
Diffstat (limited to 'test/valid-path-1.c')
-rw-r--r--test/valid-path-1.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/valid-path-1.c b/test/valid-path-1.c
new file mode 100644
index 0000000..6687d59
--- /dev/null
+++ b/test/valid-path-1.c
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) Eric Wong, 2012
+ * License: GPLv3 or later (see COPYING for details)
+ */
+#include "check.h"
+#define VP(path) mog_valid_path((path), sizeof(path) - 1)
+
+int main(void)
+{
+        assert(0 == VP("hello/.."));
+        assert(1 == VP("hello/"));
+        assert(1 == VP("hello.fid"));
+        assert(0 == VP("../hello.fid"));
+        assert(0 == VP("/../hello.fid"));
+        assert(0 == VP("/hello.fid/.."));
+        assert(0 == VP("/hello/../fid"));
+
+        return 0;
+}