mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
test enum printing
This commit is contained in:
parent
7456d556e1
commit
3d1db3519d
@ -24,15 +24,18 @@ fn test_in() {
|
||||
num := 3 // used to be an expr bug before `in`
|
||||
assert color in [.red, .green]
|
||||
assert num == 3
|
||||
}
|
||||
println(color)
|
||||
assert true
|
||||
}
|
||||
|
||||
fn test_match() {
|
||||
color := Color.red
|
||||
color := Color.green
|
||||
num := 3
|
||||
match color {
|
||||
.red { assert true }
|
||||
.green { assert false }
|
||||
.red { assert false }
|
||||
.green { assert true }
|
||||
else { assert false }
|
||||
}
|
||||
}
|
||||
println(color)
|
||||
assert num == 3
|
||||
}
|
||||
}
|
||||
|
@ -229,8 +229,11 @@ fn (p &Parser) gen_fmt() {
|
||||
}
|
||||
//s := p.scanner.fmt_out.str().replace('\n\n\n', '\n').trim_space()
|
||||
//s := p.scanner.fmt_out.str().trim_space()
|
||||
s := p.scanner.fmt_lines.join('').trim_space().replace('\n\n\n\n', '\n\n')
|
||||
.replace(' \n', '\n')
|
||||
s := p.scanner.fmt_lines.join('').trim_space().replace_each([
|
||||
'\n\n\n\n', '\n\n',
|
||||
' \n', '\n',
|
||||
') or{', ') or {',
|
||||
])
|
||||
if s == '' {
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user