shithub: mc

Download patch

ref: 76fe8d4412f3854075000a0718e30abdfd7a9087
parent: 875d2f385513fef710c0f7b193b9981d980773dd
author: Ori Bernstein <ori@markovcorp.com>
date: Fri Nov 16 09:03:55 EST 2018

Add some negative tests.

--- a/lib/std/test/strfind.myr
+++ b/lib/std/test/strfind.myr
@@ -13,6 +13,18 @@
 		[.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)
+			;;
+		}],
 	][:])
 }