aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2017-02-07 11:26:12 +0100
committerMarc André Tanner <mat@brain-dump.org>2017-02-07 11:32:47 +0100
commitcc0f8e94fed7fa2542d746361acdbfe76401a93e (patch)
tree379109844bb8647534bcd6033f4fe55af404c6d1
parent6fce999e94d46c30e6c26ef31767279f813c90b5 (diff)
downloadvis-cc0f8e94fed7fa2542d746361acdbfe76401a93e.tar.gz
vis-cc0f8e94fed7fa2542d746361acdbfe76401a93e.tar.xz
test: add a few new tests related to text objects
-rw-r--r--vim/text-objects/words-count.in1
-rw-r--r--vim/text-objects/words-count.keys3
-rw-r--r--vim/text-objects/words-eol.in (renamed from vim/text-objects/words.in)0
-rw-r--r--vim/text-objects/words-eol.keys (renamed from vim/text-objects/words.keys)0
-rw-r--r--vis/text-objects/entire.in8
-rw-r--r--vis/text-objects/entire.keys1
-rw-r--r--vis/text-objects/entire.ref8
-rw-r--r--vis/text-objects/functions.in26
-rw-r--r--vis/text-objects/functions.keys9
-rw-r--r--vis/text-objects/functions.ref12
-rw-r--r--vis/text-objects/indentation.in16
-rw-r--r--vis/text-objects/indentation.keys4
-rw-r--r--vis/text-objects/indentation.ref16
-rw-r--r--vis/text-objects/line.in6
-rw-r--r--vis/text-objects/line.keys9
-rw-r--r--vis/text-objects/line.ref2
-rw-r--r--vis/text-objects/search-result.in8
-rw-r--r--vis/text-objects/search-result.keys8
-rw-r--r--vis/text-objects/search-result.ref8
19 files changed, 145 insertions, 0 deletions
diff --git a/vim/text-objects/words-count.in b/vim/text-objects/words-count.in
new file mode 100644
index 0000000..b4c23e1
--- /dev/null
+++ b/vim/text-objects/words-count.in
@@ -0,0 +1 @@
+The brown fox jumps over the lazy dog.
diff --git a/vim/text-objects/words-count.keys b/vim/text-objects/words-count.keys
new file mode 100644
index 0000000..6cc6542
--- /dev/null
+++ b/vim/text-objects/words-count.keys
@@ -0,0 +1,3 @@
+3ciwchanged<Escape>
+/fox<Enter>
+5.
diff --git a/vim/text-objects/words.in b/vim/text-objects/words-eol.in
index 422c2b7..422c2b7 100644
--- a/vim/text-objects/words.in
+++ b/vim/text-objects/words-eol.in
diff --git a/vim/text-objects/words.keys b/vim/text-objects/words-eol.keys
index 353f4b3..353f4b3 100644
--- a/vim/text-objects/words.keys
+++ b/vim/text-objects/words-eol.keys
diff --git a/vis/text-objects/entire.in b/vis/text-objects/entire.in
new file mode 100644
index 0000000..31af792
--- /dev/null
+++ b/vis/text-objects/entire.in
@@ -0,0 +1,8 @@
+
+ Heading
+ -------
+
+ 1. first
+
+ 2. second
+
diff --git a/vis/text-objects/entire.keys b/vis/text-objects/entire.keys
new file mode 100644
index 0000000..10013ad
--- /dev/null
+++ b/vis/text-objects/entire.keys
@@ -0,0 +1 @@
+>ie
diff --git a/vis/text-objects/entire.ref b/vis/text-objects/entire.ref
new file mode 100644
index 0000000..7674f68
--- /dev/null
+++ b/vis/text-objects/entire.ref
@@ -0,0 +1,8 @@
+
+ Heading
+ -------
+
+ 1. first
+
+ 2. second
+
diff --git a/vis/text-objects/functions.in b/vis/text-objects/functions.in
new file mode 100644
index 0000000..5179cb2
--- /dev/null
+++ b/vis/text-objects/functions.in
@@ -0,0 +1,26 @@
+static double pi = 3.14;
+
+/* addition */
+int add(int a, int b) {
+ return a+b;
+}
+
+static double e = 2.71;
+
+/* multiplication of
+ *
+ * a*b
+ */
+int mul(int a, int b)
+{
+ return a*b;
+}
+
+static double sqrt2 = 1.41;
+
+int
+div(int a, int b)
+{
+ return a/b;
+}
+
diff --git a/vis/text-objects/functions.keys b/vis/text-objects/functions.keys
new file mode 100644
index 0000000..32c5a70
--- /dev/null
+++ b/vis/text-objects/functions.keys
@@ -0,0 +1,9 @@
+]]
+daf
+O/<C-v>/ add<Escape>
+]]
+daf
+O/<C-v>/ mul<Escape>
+]]
+daf
+O/<C-v>/ div<Escape>
diff --git a/vis/text-objects/functions.ref b/vis/text-objects/functions.ref
new file mode 100644
index 0000000..0b3ce0f
--- /dev/null
+++ b/vis/text-objects/functions.ref
@@ -0,0 +1,12 @@
+static double pi = 3.14;
+
+// add
+
+static double e = 2.71;
+
+// mul
+
+static double sqrt2 = 1.41;
+
+// div
+
diff --git a/vis/text-objects/indentation.in b/vis/text-objects/indentation.in
new file mode 100644
index 0000000..8ab6759
--- /dev/null
+++ b/vis/text-objects/indentation.in
@@ -0,0 +1,16 @@
+static ssize_t write_all(int fd, const char *buf, size_t count) {
+ size_t rem = count;
+ while (rem > 0) {
+ ssize_t written = write(fd, buf, rem);
+ if (written < 0) {
+ if (errno == EAGAIN || errno == EINTR)
+ continue;
+ return -1;
+ } else if (written == 0) {
+ break;
+ }
+ rem -= written;
+ buf += written;
+ }
+ return count - rem;
+}
diff --git a/vis/text-objects/indentation.keys b/vis/text-objects/indentation.keys
new file mode 100644
index 0000000..75c612d
--- /dev/null
+++ b/vis/text-objects/indentation.keys
@@ -0,0 +1,4 @@
+/continue<Enter>
+3vi<Tab>
+:x/^/ c/\/\/<Enter>
+<Escape>
diff --git a/vis/text-objects/indentation.ref b/vis/text-objects/indentation.ref
new file mode 100644
index 0000000..ad35e8e
--- /dev/null
+++ b/vis/text-objects/indentation.ref
@@ -0,0 +1,16 @@
+static ssize_t write_all(int fd, const char *buf, size_t count) {
+ size_t rem = count;
+ while (rem > 0) {
+// ssize_t written = write(fd, buf, rem);
+// if (written < 0) {
+// if (errno == EAGAIN || errno == EINTR)
+// continue;
+// return -1;
+// } else if (written == 0) {
+// break;
+// }
+// rem -= written;
+// buf += written;
+ }
+ return count - rem;
+}
diff --git a/vis/text-objects/line.in b/vis/text-objects/line.in
new file mode 100644
index 0000000..0c6acfa
--- /dev/null
+++ b/vis/text-objects/line.in
@@ -0,0 +1,6 @@
+normal line
+ normal line with white space
+normal line
+ normal line with white space
+inner line
+ inner line with white space
diff --git a/vis/text-objects/line.keys b/vis/text-objects/line.keys
new file mode 100644
index 0000000..0c3ee72
--- /dev/null
+++ b/vis/text-objects/line.keys
@@ -0,0 +1,9 @@
+dal
+.
+2.
+cil>was an inner line<<Escape>
+.
+j
+.
+g0i|<Escape>
+$.
diff --git a/vis/text-objects/line.ref b/vis/text-objects/line.ref
new file mode 100644
index 0000000..4a8cc7b
--- /dev/null
+++ b/vis/text-objects/line.ref
@@ -0,0 +1,2 @@
+>was an inner line<
+| >was an inner line< |
diff --git a/vis/text-objects/search-result.in b/vis/text-objects/search-result.in
new file mode 100644
index 0000000..44421e4
--- /dev/null
+++ b/vis/text-objects/search-result.in
@@ -0,0 +1,8 @@
+// add static using gn
+void f1(void);
+void f2(void);
+void f3(void);
+// add static using gN
+void f4(void);
+void f5(void);
+void f6(void);
diff --git a/vis/text-objects/search-result.keys b/vis/text-objects/search-result.keys
new file mode 100644
index 0000000..051b4e2
--- /dev/null
+++ b/vis/text-objects/search-result.keys
@@ -0,0 +1,8 @@
+/void<Enter>
+cgnstatic void<Escape>
+2.
+.
+G$
+c2gNstatic void<Escape>
+3.
+.
diff --git a/vis/text-objects/search-result.ref b/vis/text-objects/search-result.ref
new file mode 100644
index 0000000..3713c1c
--- /dev/null
+++ b/vis/text-objects/search-result.ref
@@ -0,0 +1,8 @@
+// add static using gn
+static void f1(void);
+static void f2(void);
+static void f3(void);
+// add static using gN
+static void f4(void);
+static void f5(void);
+static void f6(void);