fmt: fix errors in test files

pull/3951/head
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 mut a := 3 + 3
a = 10 a = 10
a++ a++
@ -36,8 +36,9 @@ enum PrivateEnum {
struct User { struct User {
name string name string
age int
very_long_field bool very_long_field bool
mut:
age int
} }
fn abc() int { fn abc() int {
@ -59,6 +60,7 @@ fn new_user() User {
[inline] [inline]
fn fn_contains_index_expr() { fn fn_contains_index_expr() {
arr := [1, 2, 3, 4, 5]
a := 1 in arr[0..] a := 1 in arr[0..]
b := 1 in arr[..2] b := 1 in arr[..2]
c := 1 in arr[1..3] c := 1 in arr[1..3]
@ -107,7 +109,7 @@ fn get_user_ptr() &User {
fn fn_with_defer() { fn fn_with_defer() {
defer { defer {
close() voidfn()
} }
} }
@ -158,6 +160,13 @@ fn fn_with_or() int {
return 20 return 20
} }
fn fn_with_optional() ?int {
if true {
return error('true')
}
return 30
}
fn (f Foo) method_with_or() int { fn (f Foo) method_with_or() int {
f.fn_with_optional() or { f.fn_with_optional() or {
return 10 return 10
@ -165,6 +174,13 @@ fn (f Foo) method_with_or() int {
return 20 return 20
} }
fn (f Foo) fn_with_optional() ?int {
if true {
return error('true')
}
return 40
}
fn fn_with_match_expr() { fn fn_with_match_expr() {
a := 10 a := 10
b := match a { b := match a {

View File

@ -1,4 +1,4 @@
fn hello() fn main()
{ {
mut a:= 3 + 3 mut a:= 3 + 3
a = 10 a = 10
@ -35,9 +35,10 @@ enum PrivateEnum{
struct User { struct User {
name string name string
age int
very_long_field bool very_long_field bool
mut:
age int
} }
@ -62,6 +63,7 @@ User
[inline] [inline]
fn fn_contains_index_expr() { fn fn_contains_index_expr() {
arr := [1, 2, 3, 4, 5]
a := 1 in arr[0..] a := 1 in arr[0..]
b := 1 in arr[..2] b := 1 in arr[..2]
c := 1 in arr[1..3] c := 1 in arr[1..3]
@ -109,7 +111,7 @@ fn get_user_ptr() & User {
} }
fn fn_with_defer() { fn fn_with_defer() {
defer { close() defer { voidfn()
} }
} }
@ -160,6 +162,13 @@ fn fn_with_or() int {
return 20 return 20
} }
fn fn_with_optional() ?int {
if true {
return error('true')
}
return 30
}
fn (f Foo) method_with_or() int { fn (f Foo) method_with_or() int {
f.fn_with_optional() or { f.fn_with_optional() or {
return 10 return 10
@ -167,6 +176,13 @@ fn (f Foo) method_with_or() int {
return 20 return 20
} }
fn (f Foo) fn_with_optional() ?int {
if true {
return error('true')
}
return 40
}
fn fn_with_match_expr() { fn fn_with_match_expr() {
a := 10 a := 10
b := match a { b := match a {