summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2014-11-04 21:53:47 -0500
committerOri Bernstein <ori@eigenstate.org>2014-11-04 21:53:47 -0500
commitbe5462a429323b0c69e9cb4061bdc520be9727c1 (patch)
treeb658190273c2d17a07ebbb1c2b55975c044bae58
parent09af6b8f6597c29208b8725b4f67bd7ed6d45e85 (diff)
downloadmc-be5462a429323b0c69e9cb4061bdc520be9727c1.tar.gz
Fix most tests.
Matching constants is still buggered.
-rw-r--r--libstd/search.myr2
-rw-r--r--libstd/sort.myr2
-rw-r--r--test/genericret.myr1
-rw-r--r--test/generictype.myr1
-rw-r--r--test/matchargstr.myr1
-rw-r--r--test/matchargunion.myr9
-rw-r--r--test/matchbind.myr1
-rw-r--r--test/matchint.myr1
-rw-r--r--test/matchunion_sl.myr1
-rw-r--r--test/nestucon.myr1
-rw-r--r--test/stdsearch.myr1
11 files changed, 17 insertions, 4 deletions
diff --git a/libstd/search.myr b/libstd/search.myr
index 54deb21..26b9870 100644
--- a/libstd/search.myr
+++ b/libstd/search.myr
@@ -15,6 +15,8 @@ generic lsearch = {sl, val, cmp
match cmp(sl[i], val)
| `Equal:
-> `Some i
+ | _:
+ /* nothing */
;;
;;
-> `None
diff --git a/libstd/sort.myr b/libstd/sort.myr
index 37cffec..dbf48d3 100644
--- a/libstd/sort.myr
+++ b/libstd/sort.myr
@@ -40,10 +40,12 @@ generic siftdown = {sl, start, cmp
s = r
match cmp(sl[s], sl[c])
| `Before: s = c
+ | _: /* nothing */
;;
if c + 1 < sl.len
match cmp(sl[s], sl[c + 1])
| `Before: s = c + 1
+ | _: /* nothing */
;;
;;
if s != r
diff --git a/test/genericret.myr b/test/genericret.myr
index d53de5d..08dd2b3 100644
--- a/test/genericret.myr
+++ b/test/genericret.myr
@@ -12,6 +12,7 @@ const f = {-> t(int)
const main = {
match f()
| `None: std.exit(42)
+ | _: std.die("Impossible match failure\n");
;;
std.exit(0)
}
diff --git a/test/generictype.myr b/test/generictype.myr
index f4046bf..99915b3 100644
--- a/test/generictype.myr
+++ b/test/generictype.myr
@@ -13,6 +13,7 @@ const main = {
match v
| `None: std.exit(1)
| `Some 123: std.exit(0)
+ | `Some _: std.die("Impossible match failure\n")
;;
std.exit(60)
}
diff --git a/test/matchargstr.myr b/test/matchargstr.myr
index 6c87821..50d539b 100644
--- a/test/matchargstr.myr
+++ b/test/matchargstr.myr
@@ -17,6 +17,7 @@ const main = {
| `Str "fsda": std.fatal(1, "Wrong match `Str \"fsda\"\n")
| `Str "asdf": std.put("Correct `Str \"asdf\"!\n")
| `Nil: std.fatal(1, "Wrong match `Str \"fsda\"\n")
+ | _: std.fatal(1, "Impossible failed match\n")
;;
}
diff --git a/test/matchargunion.myr b/test/matchargunion.myr
index 7d12706..f5ae799 100644
--- a/test/matchargunion.myr
+++ b/test/matchargunion.myr
@@ -12,10 +12,11 @@ const main = {
v = `Int 123
match v
- | `Int 127: std.exit(42)
- | `Int 123: std.exit(69)
- | `Chr 'a': std.exit(4)
- | `Nil: std.exit(6)
+ | `Int 127: std.exit(42)
+ | `Int 123: std.exit(69)
+ | `Chr 'a': std.exit(4)
+ | `Nil: std.exit(6)
+ | _: std.die("Impossible failed match\n")
;;
}
diff --git a/test/matchbind.myr b/test/matchbind.myr
index 2bcc780..bddd4ac 100644
--- a/test/matchbind.myr
+++ b/test/matchbind.myr
@@ -16,6 +16,7 @@ const main = {
| `Int x: std.exit(x)
| `Chr 'a': std.exit(4)
| `Nil: std.exit(6)
+ | x: std.die("Impossible match failure\n")
;;
}
diff --git a/test/matchint.myr b/test/matchint.myr
index 5fc3eb4..a8f59e8 100644
--- a/test/matchint.myr
+++ b/test/matchint.myr
@@ -11,5 +11,6 @@ const main = {
| 4: std.exit(99)
| 12: std.exit(84)
| 6: std.exit(18)
+ | x: std.die("Got an unexpected int!\n")
;;
}
diff --git a/test/matchunion_sl.myr b/test/matchunion_sl.myr
index 3a4ddb3..e8f9dd7 100644
--- a/test/matchunion_sl.myr
+++ b/test/matchunion_sl.myr
@@ -15,6 +15,7 @@ const main = {
| `Int 127: std.exit(42)
| `Str s: std.put("%s\n", s)
| `Nil:
+ | _: std.die("Impossible match failure\n")
;;
}
diff --git a/test/nestucon.myr b/test/nestucon.myr
index 1939000..deee01e 100644
--- a/test/nestucon.myr
+++ b/test/nestucon.myr
@@ -13,6 +13,7 @@ const main = {
a = [.x = `Str "asdf"]
match a
| [.x=`Str s]: std.put("%s\n", s)
+ | _: std.die("Impossible match failure\n")
;;
}
diff --git a/test/stdsearch.myr b/test/stdsearch.myr
index c6f0231..3e3ac53 100644
--- a/test/stdsearch.myr
+++ b/test/stdsearch.myr
@@ -20,6 +20,7 @@ const expect = {a, b
| `std.None:
match b
| `std.Some x: std.fatal(1, "Expected `std.None, `std.None, got `std.None, `std.Some %i\n", x)
+ | `std.None: /* nothing */
;;
| `std.Some x:
match b