From f00c9e3ad1468e1377fbb7dccd9b03cdfd9369e3 Mon Sep 17 00:00:00 2001 From: Turiiya Date: Tue, 26 Mar 2024 17:41:18 +0100 Subject: [PATCH] add test --- vlib/v/checker/tests/option_multi_return_err.out | 7 +++++++ vlib/v/checker/tests/option_multi_return_err.vv | 8 ++++++++ 2 files changed, 15 insertions(+) create mode 100644 vlib/v/checker/tests/option_multi_return_err.out create mode 100644 vlib/v/checker/tests/option_multi_return_err.vv diff --git a/vlib/v/checker/tests/option_multi_return_err.out b/vlib/v/checker/tests/option_multi_return_err.out new file mode 100644 index 00000000000000..28fd7e77323c69 --- /dev/null +++ b/vlib/v/checker/tests/option_multi_return_err.out @@ -0,0 +1,7 @@ +vlib/v/checker/tests/option_multi_return_err.vv:6:14: error: split() returns `?(string, string)`, so it should have either an `or {}` block, or `?` at the end + 4 | + 5 | fn main() { + 6 | foo, bar := split('foo/bar') + | ~~~~~~~~~~~~~~~~ + 7 | println('${foo}.${bar}') + 8 | } diff --git a/vlib/v/checker/tests/option_multi_return_err.vv b/vlib/v/checker/tests/option_multi_return_err.vv new file mode 100644 index 00000000000000..d22c8aae612b87 --- /dev/null +++ b/vlib/v/checker/tests/option_multi_return_err.vv @@ -0,0 +1,8 @@ +fn split(str string) ?(string, string) { + return none +} + +fn main() { + foo, bar := split('foo/bar') + println('${foo}.${bar}') +}