summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndrew Chambers <andrewchamberss@gmail.com>2016-02-27 10:00:40 +1300
committerAndrew Chambers <andrewchamberss@gmail.com>2016-02-27 10:00:40 +1300
commit16fb3943b8f4d15b91b133f01678d04793d0d138 (patch)
treeff1b86e2a16ba9fd79661b4b41fbf8b2ead4f176 /test
parent8c05ff6402cfb8988424b10ce3846f6d270919fd (diff)
downloadmc-16fb3943b8f4d15b91b133f01678d04793d0d138.tar.gz
give tests some love
Diffstat (limited to 'test')
-rw-r--r--test/destructuretup.myr7
-rw-r--r--test/fmtalign.myr17
-rw-r--r--test/genericchain.myr2
-rw-r--r--test/initializer.myr18
-rw-r--r--test/nestedgoto.myr13
-rw-r--r--test/tests11
-rw-r--r--test/usedef.myr2
7 files changed, 66 insertions, 4 deletions
diff --git a/test/destructuretup.myr b/test/destructuretup.myr
new file mode 100644
index 0000000..a6da2b4
--- /dev/null
+++ b/test/destructuretup.myr
@@ -0,0 +1,7 @@
+use std
+
+const main = {
+ var a,b
+ ((a, b), _) = ((1, 2), 3)
+ std.assert(a+b == 3, "fail\n")
+}
diff --git a/test/fmtalign.myr b/test/fmtalign.myr
new file mode 100644
index 0000000..9ae3464
--- /dev/null
+++ b/test/fmtalign.myr
@@ -0,0 +1,17 @@
+use std
+
+pkg =
+ type msg = union
+ `Tversion tversion
+ ;;
+ type tversion = struct
+ tag : uint16
+ version : byte[:]
+ ;;
+;;
+
+const main = {
+ var msg=`Tversion [.tag=45, .version="9P2000"]
+ std.fmt("{}\n", msg)
+}
+
diff --git a/test/genericchain.myr b/test/genericchain.myr
index 0608cf6..557b900 100644
--- a/test/genericchain.myr
+++ b/test/genericchain.myr
@@ -12,5 +12,5 @@ generic try = {opt : std.option(@b)
}
const main = {
- std.put("val = %i\n", try(fail(123)))
+ std.put("val = {}\n", try(fail(123)))
}
diff --git a/test/initializer.myr b/test/initializer.myr
new file mode 100644
index 0000000..7f18806
--- /dev/null
+++ b/test/initializer.myr
@@ -0,0 +1,18 @@
+use std
+
+pkg =
+ type qid = struct
+ ty : uint8
+ path : uint64
+ ;;
+
+ type stat = struct
+ dev : uint32
+ qid : qid
+ ;;
+;;
+
+const main = {
+ var stat : stat = [.dev=0, .qid=[.ty=0, .path=0]]
+ std.assert(stat.qid.path == 0, "fail\n")
+}
diff --git a/test/nestedgoto.myr b/test/nestedgoto.myr
new file mode 100644
index 0000000..70f197d
--- /dev/null
+++ b/test/nestedgoto.myr
@@ -0,0 +1,13 @@
+use std
+
+const main = {
+ match 0
+ | 0:
+ goto ok
+ | 1:
+ :ok
+ -> void
+ | _:
+ ;;
+ std.exit(1)
+}
diff --git a/test/tests b/test/tests
index 0439482..60f6619 100644
--- a/test/tests
+++ b/test/tests
@@ -96,7 +96,7 @@ B genericrec E 0
B genericimpl P 'int string @a @a[:]'
B recgeneric P 'built'
B bigtyblob P '`U100 '
-# B genericchain P 'val = 123' ## BUGGERED
+B genericchain P 'val = 123'
B genericmake P 'val = 123'
B genericuret E 42
B sizeof E 4
@@ -138,10 +138,10 @@ B strsplit C
B strfind C
B strjoin C
B exporttrait
-# B local-labels E 10 ## BUGGERED
+B local-labels E 10
F declmismatch
F infermismatch
-# F usedef ## BUGGERED
+F usedef
F occur
F tyoccur
F union-extraarg
@@ -155,3 +155,8 @@ B voideffect P pass
B foroptexpr P pass
B bounds E 134
B rvaldotlen P pass
+B destructuretup E 0
+B nestedgoto E 0
+B initializer E 0
+B fmtalign E 0
+
diff --git a/test/usedef.myr b/test/usedef.myr
index 81c6434..b2a54a1 100644
--- a/test/usedef.myr
+++ b/test/usedef.myr
@@ -1,3 +1,5 @@
+use std
+
/*
should fail to compile because 'a' is used
before it is defined.