summaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
authorOri Bernstein <ori@markovcorp.com>2018-11-16 14:03:55 -0800
committerOri Bernstein <ori@markovcorp.com>2018-11-16 14:03:55 -0800
commit76fe8d4412f3854075000a0718e30abdfd7a9087 (patch)
treec27a0be250bc9840fbf41043ee919e9e53480586 /lib/std
parent875d2f385513fef710c0f7b193b9981d980773dd (diff)
downloadmc-76fe8d4412f3854075000a0718e30abdfd7a9087.tar.gz
Add some negative tests.
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/test/strfind.myr12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/std/test/strfind.myr b/lib/std/test/strfind.myr
index f95affc..687dc93 100644
--- a/lib/std/test/strfind.myr
+++ b/lib/std/test/strfind.myr
@@ -13,6 +13,18 @@ const main = {
[.name="reverse-fullmatch", .fn={ctx; revfindat(ctx, 1, "abc", "bc")}],
[.name="reverse-dup-1c", .fn={ctx; revfindat(ctx, 3, "abcabc", "a")}],
[.name="reverse-dup-2c", .fn={ctx; revfindat(ctx, 3, "abcabc", "ab")}],
+ [.name="long-needle", .fn={ctx
+ match std.strfind("ab", "abcabc")
+ | `std.Some _: testr.fail(ctx, "found something we shouldn't")
+ | `std.None: testr.ok(ctx)
+ ;;
+ }],
+ [.name="fail-find", .fn={ctx
+ match std.strfind("abcabc", "abd")
+ | `std.Some _: testr.fail(ctx, "found something we shouldn't")
+ | `std.None: testr.ok(ctx)
+ ;;
+ }],
][:])
}