v2 / vlib / v / fmt / tests / comments_expected.vv
90 lines · 76 sloc · 903 bytes · 54c03080edfbf59e0a0eeaec38ef27501958d83b
Raw
1import time // foo
2
3/*
4block
5comment
6*/
7
8fn fun() int {
9 return 0 // another comment
10}
11
12fn mr_fun() (int, int) {
13 return 1, 2 // another comment
14}
15
16fn single_line_blocks() {
17 // 1
18 println('')
19 // 2
20 println('')
21 // 3
22 // 4
23 println('')
24 // 5
25 // 6
26}
27
28fn main() {
29 /* block1
30 */
31 /*
32 block2 */
33 /*
34
35 block3
36
37 */
38 a := 1 // this is a comment
39 d := c // and an extra one
40 e := c
41 // more comments = more good
42 arr := [
43 // block foo bar
44 // inline foo bar
45 0,
46 ]
47 return
48}
49
50fn insert_space() {
51 // abc
52}
53
54fn linebreaks_in_block_comments() {
55 /*foo
56 comment goes here!
57 bar*/
58 /* spam
59 spaces make no difference there
60 eggs */
61}
62
63fn between_if_branches() {
64 if spam {
65 }
66 // remove the empty line above
67 else if eggs {
68 }
69
70 if spam2 {
71 }
72 // remove the empty line below
73 else {
74 }
75}
76
77for // comments
78{
79 break
80}
81
82for i := 0; i < 1; i++ // comments
83{
84 break
85}
86
87for _ in [1, 2] // comments
88{
89 break
90}
91