v/vlib/v/fmt/tests/comments_expected.vv

106 lines
1.2 KiB
V

import time // foo
/*
block
comment
*/
fn fun() int {
// comment zero
return 0 // another comment
}
fn mr_fun() (int, int) {
// one comment
// another comment
return 1, 2
}
fn single_line_blocks() {
// 1
println('')
// 2
println('')
// 3
// 4
println('')
// 5
// 6
}
fn main() {
/*
block1
*/
/*
block2
*/
/*
block3
*/
// this is a comment
a := 1
// and another comment
// just to make it worse
b, c := a, 2
d := c // and an extra one
e := c
// more comments = more good
arr := [
// block foo bar
// inline foo bar
0,
]
// before arg comment
// after arg comment
println('this is a test')
// before if expr
// after if expr
if true {
println('if')
}
// before else if
// between else if
else if false {
println('else if')
}
// before else
// after else
else {
println('else')
}
// empty return
return
}
fn insert_space() {
// abc
}
fn linebreaks_in_block_comments() {
/*
foo
comment goes here!
bar
*/
/*
spam
spaces make no difference there
eggs
*/
}
fn between_if_branches() {
if spam {
}
// remove the empty line above
else if eggs {
}
if spam2 {
}
// remove the empty line below
else {
}
}