1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

fmt: array newlines test

This commit is contained in:
Alexander Medvednikov 2020-04-18 23:58:56 +02:00
parent 85c5103ba3
commit de9f302412
2 changed files with 15 additions and 3 deletions

View File

@ -482,11 +482,11 @@ fn (var f Fmt) expr(node ast.Expr) {
f.wrap_long_line()
}
f.expr(expr)
if i < it.exprs.len - 1 {
f.write(', ')
}
if line_nr < pos.line_nr {
// Previous element was on a different line, add a newline
f.writeln('')
} else if i < it.exprs.len - 1 {
f.write(', ')
}
line_nr = pos.line_nr
}

View File

@ -0,0 +1,12 @@
fn make_flag(a, b, c string) string {
return ''
}
fn main() {
// Set up flags
expected_flags := [
make_flag('solaris', '-L', '/opt/local/lib')
make_flag('darwin', '-framework', 'Cocoa')
make_flag('windows', '-l', 'gdi32')
]
}