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