From 789a744debe2747ae7bd05c7efac81a94aa80b06 Mon Sep 17 00:00:00 2001 From: collin Date: Wed, 18 Nov 2020 18:13:49 -0800 Subject: [PATCH] add test for returning tuples from function --- compiler/tests/function/mod.rs | 10 ++++++++++ compiler/tests/function/return_tuple.leo | 11 +++++++++++ 2 files changed, 21 insertions(+) create mode 100644 compiler/tests/function/return_tuple.leo diff --git a/compiler/tests/function/mod.rs b/compiler/tests/function/mod.rs index 0c62b34e76..8d8d33e65a 100644 --- a/compiler/tests/function/mod.rs +++ b/compiler/tests/function/mod.rs @@ -174,3 +174,13 @@ fn test_return_array_tuple_pass() { assert_satisfied(program); } + +// Test return tuples + +#[test] +fn test_return_tuple() { + let bytes = include_bytes!("return_tuple.leo"); + let program = parse_program(bytes).unwrap(); + + assert_satisfied(program); +} diff --git a/compiler/tests/function/return_tuple.leo b/compiler/tests/function/return_tuple.leo new file mode 100644 index 0000000000..c459740a47 --- /dev/null +++ b/compiler/tests/function/return_tuple.leo @@ -0,0 +1,11 @@ +// Returns a tuple of tuples. +function tuples() -> ((u8, u8), u32) { + let a: (u8, u8) = (1, 2); + let b: u32 = 3; + + return (a, b) +} + +function main() { + let t = tuples(); +} \ No newline at end of file