v/vlib/v/fmt/tests/comments_input.vv

90 lines
1.2 KiB
V

import time // foo
/*
block
comment
*/
fn fun() int {
return /* comment zero */ 0 // another comment
}
fn mr_fun() (int, int) {
return /* one comment */ 1, /* another comment */ 2
}
fn single_line_blocks() {
/* 1 */
println('')
/* 2 */
println('')
/* 3 */
/* 4 */
println('')
// 5
/* 6 */
}
fn main() {
/* block1
*/
/*
block2 */
/*
block3
*/
a := /* this is a comment */ 1
b, c := /* and another comment */ a, /* just to make it worse */ 2
d := c // and an extra one
e := c
// more comments = more good
arr := [
/* block foo bar */
// inline foo bar
0,
]
println(/* before arg comment */ 'this is a test' /* after arg comment */)
if /* before if expr */ true /* after if expr */ {
println('if')
}
// before else if
else /* between else if */ if false {
println('else if')
}
// before else
else /* after else */ {
println('else')
}
return // empty 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 {
}
}