1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

fmt: fix errors in test files

This commit is contained in:
Alexey 2020-03-07 08:04:33 +03:00 committed by GitHub
parent 150994a933
commit e26907f079
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 7 deletions

View File

@ -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 {

View File

@ -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 {