aboutsummaryrefslogtreecommitdiff
path: root/tests/functions.sh
diff options
context:
space:
mode:
authorMustafa Quraish <[email protected]>2022-01-31 03:10:36 -0500
committerMustafa Quraish <[email protected]>2022-01-31 03:21:09 -0500
commit23666c777b98402ff539816e291a979d1b62a724 (patch)
tree391aef0d42e18824f8f93773be64ee95d9f30d4f /tests/functions.sh
parentAdd `std/math.cup` with some common math functions (diff)
downloadcup-23666c777b98402ff539816e291a979d1b62a724.tar.xz
cup-23666c777b98402ff539816e291a979d1b62a724.zip
Move around tests in the categories; Add missing tests
We now also test for local variables in functions, and add a simple test to see if imports work properly.
Diffstat (limited to 'tests/functions.sh')
-rwxr-xr-xtests/functions.sh5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/functions.sh b/tests/functions.sh
index 3e87b37..e8c79f2 100755
--- a/tests/functions.sh
+++ b/tests/functions.sh
@@ -23,6 +23,11 @@ fn main() { return test(2, 3); }
EOF
assert_exit_status_stdin 5 <<EOF
+fn test(a: int, b: int) { let n: int = a + b; return n; }
+fn main() { return test(2, 3); }
+EOF
+
+assert_exit_status_stdin 5 <<EOF
fn test(a: int, b: int, c: int, d: int, e: int) { return a+b+c+d+e; }
fn main() { return test(1,1,1,1,1); }
EOF