Commit d5556884c6bd447682ca5772f3215e1f9a83b1fb

Thomas de Grivel 2022-01-04T20:18:17

tests

diff --git a/Makefile b/Makefile
index e192bce..3f5e205 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,6 @@ LIBKV_SRC = \
 	kv_parse.c \
 	kv_path.c \
 	kv_quote.c \
-	kv_unquote.c \
 	rope.c
 
 LIBKV_O = ${LIBKV_SRC:.c=.o}
diff --git a/kv.c b/kv.c
index 6f01fb3..dc6769d 100644
--- a/kv.c
+++ b/kv.c
@@ -111,14 +111,16 @@ int unquote (int argc, char **argv)
   s_buffer in;
   char    *str;
   size_t   str_size;
-  int      r;
+  int      r = 1;
   if (buffer_read_files(&in, argc, argv))
     return -1;
   str = in.chars;
   str_size = in.wpos;
+  /*
   if (!(r = kv_unquote(&str, &str_size)) &&
       fwrite(str, str_size, 1, stdout) != 1)
     err(1, "stdout");
+  */
   fflush(stdout);
   free(str);
   return r;
diff --git a/kv_quote.c b/kv_quote.c
index 09f99aa..986e2d7 100644
--- a/kv_quote.c
+++ b/kv_quote.c
@@ -133,9 +133,7 @@ int kv_quote (char **str, size_t *str_size)
   }
   if (!rope)
     return 1;
-  rope_print(rope, stderr);
   rope_sort_by_size(rope);
-  rope_print(rope, stderr);
   fflush(stderr);
   *str = rope->str;
   *str_size = rope->size;
diff --git a/test/k1 b/test/k1
new file mode 100644
index 0000000..59b4609
--- /dev/null
+++ b/test/k1
@@ -0,0 +1 @@
+PlopHopToto123
\ No newline at end of file
diff --git a/test/k2 b/test/k2
new file mode 100644
index 0000000..69321f3
--- /dev/null
+++ b/test/k2
@@ -0,0 +1 @@
+Plop Hop Test 123 !!!
diff --git a/test/k3 b/test/k3
new file mode 100644
index 0000000..e9b228a
--- /dev/null
+++ b/test/k3
@@ -0,0 +1,12 @@
+Plop
+
+
+Hop
+
+
+Test
+
+
+123
+
+
diff --git a/test/k4 b/test/k4
new file mode 100644
index 0000000..0b969da
--- /dev/null
+++ b/test/k4
@@ -0,0 +1,15 @@
+Plop
+
+
+Hop
+
+
+Test
+
+
+123
+
+
+"""
+
+