ref: ae6e5736ca20bb724632b4491d0cfd72e48c99a5
parent: 231f122bcbc9010decfaae7942916d7ce948767d
author: Ori Bernstein <[email protected]>
date: Tue Feb 19 08:01:03 EST 2013
Use 'myrbuild' to build the tests This both tests 'myrbuild', and ensures that we handle dependencies and such correctly.
--- a/test/add.myr
+++ b/test/add.myr
@@ -1,3 +1,4 @@
+use std
/* should exit with status 53 */
const main = {
var a
--- a/test/arityhigh.myr
+++ b/test/arityhigh.myr
@@ -1,3 +1,4 @@
+use std
/* should fail because we call f with too many args */
const f = {a:int
--- a/test/aritylow.myr
+++ b/test/aritylow.myr
@@ -1,3 +1,4 @@
+use std
/* should fail because we call f with too few args */
const f = {a:int, b:int, c:int
--- a/test/array.myr
+++ b/test/array.myr
@@ -1,3 +1,4 @@
+use std
/* tests reading and writing to arrays. should exit with 7 */
const main = {
var a : int[3]
--- a/test/arrayaddr.myr
+++ b/test/arrayaddr.myr
@@ -1,3 +1,4 @@
+use std
/* tests taking the address of array elements. should exit with 42. */
const main = {
var v : int[3]
--- a/test/arraylen.myr
+++ b/test/arraylen.myr
@@ -1,3 +1,4 @@
+use std
/* checks that array lengths work. should exit with 12. */
const main = {
var a : int[12]
--- a/test/arraylit-ni.myr
+++ b/test/arraylit-ni.myr
@@ -1,3 +1,4 @@
+use std
/* checks that we can create arrays without indexed initializers. exits with 2. */
const main = {
var a = [1, 3, 2]
--- a/test/bsr.myr
+++ b/test/bsr.myr
@@ -1,3 +1,4 @@
+use std
/* should exit with status 5 */
const main = {
var a = 42
--- a/test/call.myr
+++ b/test/call.myr
@@ -1,3 +1,4 @@
+use std
/* checks that simple function calls work. should exit with 42. */
const f = {
-> 21
--- a/test/callbig.myr
+++ b/test/callbig.myr
@@ -1,3 +1,4 @@
+use std
/* checks that calls with large return values (ie, ones that don't fit in a
* register) works correctly. Should exit with 42. */
type pair = struct
--- a/test/condiffalse.myr
+++ b/test/condiffalse.myr
@@ -1,3 +1,4 @@
+use std
/* checks that false conditions lead to the false branch of an if statement.
* should exit with 9. */
var x = 5
--- a/test/condifrel.myr
+++ b/test/condifrel.myr
@@ -1,3 +1,4 @@
+use std
/* checks if relatonal operators work. should exit with 9. */
var x = 3
var y = 9
--- a/test/condiftrue.myr
+++ b/test/condiftrue.myr
@@ -1,3 +1,4 @@
+use std
/* checks that true complex boolean conditions work. exits with 7. */
var x = 5
var y = 7
--- a/test/declmismatch.myr
+++ b/test/declmismatch.myr
@@ -1,3 +1,4 @@
+use std
/*
should fail to compile with a type error.
char is incompatible with int.
--- a/test/derefassign.myr
+++ b/test/derefassign.myr
@@ -1,3 +1,4 @@
+use std
/* should assign to v through pointer p, exiting with 123 */
const main = {
var p
--- a/test/div.myr
+++ b/test/div.myr
@@ -1,3 +1,4 @@
+use std
/* should exit with status 42 */
const main = {
var a
--- a/test/fib.myr
+++ b/test/fib.myr
@@ -1,3 +1,4 @@
+use std
/* checks if recursive functions work. should return 21. */
const fib = {n
if n <= 0
--- a/test/generic-in-const.myr
+++ b/test/generic-in-const.myr
@@ -1,3 +1,4 @@
+use std
/*
should fail to compile because generic types
are only allowed in generic declarations.
--- a/test/generic.myr
+++ b/test/generic.myr
@@ -1,3 +1,4 @@
+use std
/* checks that simple generics are specialized correctly. exits with 42. */
generic id = {a:@a
-> a
--- a/test/genericcall.myr
+++ b/test/genericcall.myr
@@ -1,3 +1,4 @@
+use std
/* checks that generics can call non-generics. exits with 42. */
const f = {
-> 42
--- a/test/global-arrayvar.myr
+++ b/test/global-arrayvar.myr
@@ -1,3 +1,4 @@
+use std
/* tests that global arrays work as expected, and are zero-initialized by
* default. should exit with 7 */
var a : int[10]
--- a/test/gsizeof.myr
+++ b/test/gsizeof.myr
@@ -1,3 +1,4 @@
+use std
/* checks that sizeof works on generics. exits with 5. */
generic sz = {a:@a
-> sizeof(@a)
--- a/test/infermismatch.myr
+++ b/test/infermismatch.myr
@@ -1,3 +1,4 @@
+use std
/*
should fail to compile after infering that a is a float, b is a char, and
the types are incompatible.
--- a/test/log-and.myr
+++ b/test/log-and.myr
@@ -1,3 +1,4 @@
+use std
/* checks that evaluating a logical and to a bool works. should return 0. */
const main = {
-> 0 && 1
--- a/test/log-or.myr
+++ b/test/log-or.myr
@@ -1,3 +1,4 @@
+use std
/* checks that evaluating a logical or works. exits with 1. */
const main = {
-> 0 || 1
--- a/test/loop.myr
+++ b/test/loop.myr
@@ -1,3 +1,4 @@
+use std
/* checks that loops work. exits with 45. */
const main = {
var i
--- a/test/main.myr
+++ b/test/main.myr
@@ -1,2 +1,3 @@
+use std
/* should exit with status 0 */
const main = {; -> 0 }
--- a/test/match-badtypes.myr
+++ b/test/match-badtypes.myr
@@ -1,3 +1,4 @@
+use std
/*
should fail to compile because
all types matched over should be
--- a/test/matchargunion.myr
+++ b/test/matchargunion.myr
@@ -1,3 +1,4 @@
+use std
/* checks pattern matching on unions with arguments.
exits with 42. */
type u = union
--- a/test/matchbind.myr
+++ b/test/matchbind.myr
@@ -1,3 +1,4 @@
+use std
/* checks that we can bind values in pattern matches.
exits with 11. */
type u = union
--- a/test/matchconst.myr
+++ b/test/matchconst.myr
@@ -1,3 +1,4 @@
+use std
/* checks that matching works when comparing against constants,
instead of just literals. exits with 88. */
/* some misc constants */
--- a/test/matchint.myr
+++ b/test/matchint.myr
@@ -1,3 +1,4 @@
+use std
/* checks that matching integers works. exits with 84. */
const main = {
var v
--- a/test/matchunion.myr
+++ b/test/matchunion.myr
@@ -1,3 +1,4 @@
+use std
/* checks that union matching works, at least on the key.
exits with 84. */
type u = union
--- a/test/mkunion.myr
+++ b/test/mkunion.myr
@@ -1,3 +1,4 @@
+use std
/* checks that union creation works. exits with 0. */
type u = union
`Some int
--- a/test/mod.myr
+++ b/test/mod.myr
@@ -1,3 +1,4 @@
+use std
/* should exit with status 6 */
const main = {
var a = 42
--- a/test/mul.myr
+++ b/test/mul.myr
@@ -1,3 +1,4 @@
+use std
/* should exit with status 42 */
const main = {
var a = 7
--- a/test/nestfn.myr
+++ b/test/nestfn.myr
@@ -1,3 +1,4 @@
+use std
/* checks that nested functions without environment capture work. should
* exit with 42. */
const main = {
--- a/test/neststruct.myr
+++ b/test/neststruct.myr
@@ -1,3 +1,4 @@
+use std
/* tests that nested structs work. should exit with 3 */
type s1 = struct
x : s2
--- a/test/occur.myr
+++ b/test/occur.myr
@@ -1,3 +1,4 @@
+use std
/* checks that f is not an infinite type (ie, the type
doesn't exist within itself). If 'f' typechecked,
it's type would be:
--- a/test/outparam-sl.myr
+++ b/test/outparam-sl.myr
@@ -1,3 +1,4 @@
+use std
/* should assign a slice through an out param, returning exiting with 2 */
const arr = [1,2,3,4]
const f = {out
--- a/test/outparam.myr
+++ b/test/outparam.myr
@@ -1,3 +1,4 @@
+use std
/* should assign through an out pointer parameter, exiting with status 42 */
const f = {out
*out = 42
--- a/test/overlappingif.myr
+++ b/test/overlappingif.myr
@@ -1,3 +1,4 @@
+use std
/* checks that if multiple if conditions are valid, only the first is
* selected. should exit with 2. */
const main = {
--- a/test/ptrpreinc.myr
+++ b/test/ptrpreinc.myr
@@ -1,3 +1,4 @@
+use std
/* should preincrement through a pointer, exiting with status 9 */
const ppreinc = {p
-> ++*p
--- a/test/sizeof.myr
+++ b/test/sizeof.myr
@@ -1,3 +1,4 @@
+use std
/* checks that sizeof() works. exits with 4. */
const main = {
-> sizeof(int)
--- a/test/slice.myr
+++ b/test/slice.myr
@@ -1,3 +1,4 @@
+use std
/* checks that taking slices of arrays works. should exit with 7 */
const main = {
var a : int[3]
--- a/test/slicelen.myr
+++ b/test/slicelen.myr
@@ -1,3 +1,4 @@
+use std
/* checks that taking incomplete slices calculates the length correctly.
* should exit with 5. */
const main = {
--- a/test/str.myr
+++ b/test/str.myr
@@ -1,3 +1,4 @@
+use std
/* checks that string literals are compiled correctly.
exits with ascii 'f', ie, 102. */
const main = {
--- a/test/struct.myr
+++ b/test/struct.myr
@@ -1,3 +1,4 @@
+use std
/* test reading and writing to struct members. exits with 42. */
type pair = struct
a : int
--- a/test/struct1.myr
+++ b/test/struct1.myr
@@ -1,3 +1,4 @@
+use std
/*
make sure assigning to a 1-element struct works; exit status should be 12
*/
--- a/test/structarray.myr
+++ b/test/structarray.myr
@@ -1,3 +1,4 @@
+use std
/* tests a struct containing an array. exit status should be 42. */
type t = struct
a : int[42]
--- a/test/structasn.myr
+++ b/test/structasn.myr
@@ -1,3 +1,4 @@
+use std
/* tests block assignment of structs. exits with 42.*/
type pair = struct
a : int
--- a/test/structptr.myr
+++ b/test/structptr.myr
@@ -1,3 +1,4 @@
+use std
/* tests reading and writing through a struct pointer. exits with 42. */
type pair = struct
a : int
--- a/test/structret.myr
+++ b/test/structret.myr
@@ -1,3 +1,4 @@
+use std
/* tests returning large structs. should exit with 42. */
type pair = struct
a : int
--- a/test/swidencast.myr
+++ b/test/swidencast.myr
@@ -1,3 +1,4 @@
+use std
/* sign extending cast. should exit with status 99 */
const main = {
var u : int8
--- a/test/test.sh
+++ b/test/test.sh
@@ -14,14 +14,7 @@
function build {
rm -f $1 $1.o $1.s $1.use
- echo " "$MC -I ../libstd $1.myr && \
- $MC -I ../libstd $1.myr && \
- echo " "$LD -o $1 $1.o -L../libstd -lstd && \
- if [ "x`uname`" = "xDarwin" ]; then
- $LD -macosx_version_min 10.6 -o $1 $1.o -L../libstd -lstd
- else
- $LD -o $1 $1.o -L../libstd -lstd
- fi
+ ../myrbuild/myrbuild -b $1 $1.myr -C../6/6m -I../libstd
}
function prints {
--- a/test/trait-builtin.myr
+++ b/test/trait-builtin.myr
@@ -1,3 +1,4 @@
+use std
/* checks that generic types with traits are compiled correctly.
without the 'tcnum' trait on '@a', the '>' operator would not work
within max. without the 'tctest' trait on '@a' in intlike_is42,
--- a/test/trunccast.myr
+++ b/test/trunccast.myr
@@ -1,3 +1,4 @@
+use std
/* should truncate y when casting to x, exiting with status 15 */
const main = {
var x : int8
--- a/test/tuple.myr
+++ b/test/tuple.myr
@@ -1,3 +1,4 @@
+use std
/* checks that we can create tuples and destructure them. exits with 42. */
const main = {
var v
--- a/test/tyoccur.myr
+++ b/test/tyoccur.myr
@@ -1,3 +1,4 @@
+use std
/* checks that types do not contain themselves
inline, because that would lead to an infinite
sized type.
--- a/test/tyrec.myr
+++ b/test/tyrec.myr
@@ -1,3 +1,4 @@
+use std
/* we just want to see if this file compiles */
type foo = struct
v : foo*
--- a/test/union-extraarg.myr
+++ b/test/union-extraarg.myr
@@ -1,3 +1,4 @@
+use std
/*
should fail to compile becuse
we're constructing a union that
--- a/test/union-missingarg.myr
+++ b/test/union-missingarg.myr
@@ -1,3 +1,4 @@
+use std
type u = union
`Foo int
;;
--- a/test/voidcall.myr
+++ b/test/voidcall.myr
@@ -1,3 +1,4 @@
+use std
/* checks that calling void functions works. should compile, and not die
when running. the exit value is 12, but it's really a dummy. */
const f = {
--- a/test/zwidencast.myr
+++ b/test/zwidencast.myr
@@ -1,3 +1,4 @@
+use std
/* should zero-extend u when casting to v, returning 99 */
const main = {
var u : uint8