summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2022-11-15 01:20:07 +0100
committerLeah Neukirchen <leah@vuxu.org>2022-11-15 01:20:07 +0100
commit2f6a20240df228e71503c2dc1e3a41e75d50f54b (patch)
tree7e9347346ccbb697a229d1bfda3fd596ed106aa1 /tests
parent4e97f590bcf7d039744ba4c8a94a9cda333abbf9 (diff)
downloadmew-2f6a20240df228e71503c2dc1e3a41e75d50f54b.tar.gz
mew-2f6a20240df228e71503c2dc1e3a41e75d50f54b.tar.xz
mew-2f6a20240df228e71503c2dc1e3a41e75d50f54b.zip
add search
Diffstat (limited to 'tests')
-rw-r--r--tests/test.mew18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test.mew b/tests/test.mew
index a6632e9..b895780 100644
--- a/tests/test.mew
+++ b/tests/test.mew
@@ -498,4 +498,22 @@
   (test "foo 1 2" (condition-case (fail "foo ~a ~a" 1 2)
                     (e (exn) (get-condition-property e 'exn 'message)))))
 
+(test-group "search"
+  (test #f (search "foozing" "fooz00000fggg00foozixngbar"))
+  (test 7 (search "foozing" "foodingfoozingbar"))
+  (test 15 (search "foozing" "fooz00000fggg00foozingbar"))
+  (test 16 (search "foozinggg" "foozinggfoozinggfoozingggfoozingg"))
+  (test 0 (search "foobar" "foobar"))
+  (test #f (search "foobar" "foobax"))
+  (test #f (search "foobar" "000000"))
+  (test #f (search "foobar" "fooba"))
+  (test 4 (search "fofofox" "fofofofofox"))
+  (test #f (search "fofofox" ""))
+  (test 0 (search "" "fofofox"))
+  (test 6 (search "x" "fofofox"))
+  (test 4 (search "foo" "fooxfoo" 3))
+  (test #f (search "foo" "fooxfoo" 5))
+  (test 1 (search #(1 2 3) #(0 1 2 3 4)))
+  (test 1 (search '(1 2 3) '(0 1 2 3 4))))
+
 (test-exit)