From 6b2ff65735bb8229af9994db8221303b73a8194b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Mon, 8 Mar 2021 00:18:31 +0100 Subject: add tests --- progs/tests/tuples.sy | 12 ++++++++++++ progs/tests/tuples_fail_out_of_bounds.sy | 6 ++++++ 2 files changed, 18 insertions(+) create mode 100644 progs/tests/tuples.sy create mode 100644 progs/tests/tuples_fail_out_of_bounds.sy diff --git a/progs/tests/tuples.sy b/progs/tests/tuples.sy new file mode 100644 index 0000000..74f2701 --- /dev/null +++ b/progs/tests/tuples.sy @@ -0,0 +1,12 @@ +start :: fn { + a := (1,2) + a[0] <=> 1 + a[1] <=> 2 + + b := (1,) + b[0] <=> 1 + + empty := () + c := (empty,) + c[0] <=> () +} diff --git a/progs/tests/tuples_fail_out_of_bounds.sy b/progs/tests/tuples_fail_out_of_bounds.sy new file mode 100644 index 0000000..cb0764a --- /dev/null +++ b/progs/tests/tuples_fail_out_of_bounds.sy @@ -0,0 +1,6 @@ +start :: fn { + a := (1, 2) + a[2] +} + +// errors: [ErrorKind::IndexOutOfBounds(_, 2, 2)] -- cgit v1.2.1