summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2014-12-18 23:45:34 -0800
committerOri Bernstein <ori@eigenstate.org>2014-12-18 23:45:34 -0800
commit9be5f6e05a432918ab171ad27183b010d0855457 (patch)
tree5f85f3e81f4911b6f05e050da4357166626604a4 /test
parent28fd8a46376eef8895573949da7cac6fbe6775c5 (diff)
downloadmc-9be5f6e05a432918ab171ad27183b010d0855457.tar.gz
Add tests for trait impls.
Diffstat (limited to 'test')
-rw-r--r--test/tests2
-rw-r--r--test/traitimpl.myr11
2 files changed, 10 insertions, 3 deletions
diff --git a/test/tests b/test/tests
index 9611d69..7c8684f 100644
--- a/test/tests
+++ b/test/tests
@@ -79,7 +79,7 @@ B generic E 42
B genericval E 42
B trait-builtin E 42
B emptytrait E 123
-B traitimpl P 246,44
+B traitimpl P 246,44,meee
# B compoundimpl P intptr,charptr BUGGERED
B nestucon P asdf
B mkunion E 0
diff --git a/test/traitimpl.myr b/test/traitimpl.myr
index 4e0d617..172478f 100644
--- a/test/traitimpl.myr
+++ b/test/traitimpl.myr
@@ -16,14 +16,21 @@ impl frobable int16 =
}
;;
+impl frobable byte[:] =
+ frob = {val
+ -> val[:4]
+ }
+;;
+
generic foo = {x : @a::frobable
-> frob(x)
}
const main = {
- var a, b
+ var a, b, c
a = foo(123)
b = foo(11 castto(int16))
- std.put("%i,%w\n", a, b)
+ c = frob("meeeeeeh")
+ std.put("%i,%w,%s\n", a, b, c)
}