diff --git a/vlib/v/fmt/tests/simple_expected.vv b/vlib/v/fmt/tests/simple_expected.vv index c47dba4148..4a81a562d6 100644 --- a/vlib/v/fmt/tests/simple_expected.vv +++ b/vlib/v/fmt/tests/simple_expected.vv @@ -1,4 +1,4 @@ -fn hello() { +fn main() { mut a := 3 + 3 a = 10 a++ @@ -36,8 +36,9 @@ enum PrivateEnum { struct User { name string - age int very_long_field bool +mut: + age int } fn abc() int { @@ -59,6 +60,7 @@ fn new_user() User { [inline] fn fn_contains_index_expr() { + arr := [1, 2, 3, 4, 5] a := 1 in arr[0..] b := 1 in arr[..2] c := 1 in arr[1..3] @@ -107,7 +109,7 @@ fn get_user_ptr() &User { fn fn_with_defer() { defer { - close() + voidfn() } } @@ -158,6 +160,13 @@ fn fn_with_or() int { return 20 } +fn fn_with_optional() ?int { + if true { + return error('true') + } + return 30 +} + fn (f Foo) method_with_or() int { f.fn_with_optional() or { return 10 @@ -165,6 +174,13 @@ fn (f Foo) method_with_or() int { return 20 } +fn (f Foo) fn_with_optional() ?int { + if true { + return error('true') + } + return 40 +} + fn fn_with_match_expr() { a := 10 b := match a { diff --git a/vlib/v/fmt/tests/simple_input.vv b/vlib/v/fmt/tests/simple_input.vv index 0025efdd2f..3bed273099 100644 --- a/vlib/v/fmt/tests/simple_input.vv +++ b/vlib/v/fmt/tests/simple_input.vv @@ -1,4 +1,4 @@ -fn hello() +fn main() { mut a:= 3 + 3 a = 10 @@ -35,9 +35,10 @@ enum PrivateEnum{ struct User { name string - age int - very_long_field bool + +mut: + age int } @@ -62,6 +63,7 @@ User [inline] fn fn_contains_index_expr() { + arr := [1, 2, 3, 4, 5] a := 1 in arr[0..] b := 1 in arr[..2] c := 1 in arr[1..3] @@ -109,7 +111,7 @@ fn get_user_ptr() & User { } fn fn_with_defer() { -defer { close() +defer { voidfn() } } @@ -160,6 +162,13 @@ fn fn_with_or() int { return 20 } +fn fn_with_optional() ?int { + if true { + return error('true') + } + return 30 +} + fn (f Foo) method_with_or() int { f.fn_with_optional() or { return 10 @@ -167,6 +176,13 @@ fn (f Foo) method_with_or() int { return 20 } +fn (f Foo) fn_with_optional() ?int { + if true { + return error('true') + } + return 40 +} + fn fn_with_match_expr() { a := 10 b := match a {