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`
|
num := 3 // used to be an expr bug before `in`
|
||||||
assert color in [.red, .green]
|
assert color in [.red, .green]
|
||||||
assert num == 3
|
assert num == 3
|
||||||
|
println(color)
|
||||||
|
assert true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_match() {
|
fn test_match() {
|
||||||
color := Color.red
|
color := Color.green
|
||||||
num := 3
|
num := 3
|
||||||
match color {
|
match color {
|
||||||
.red { assert true }
|
.red { assert false }
|
||||||
.green { assert false }
|
.green { assert true }
|
||||||
else { assert false }
|
else { assert false }
|
||||||
}
|
}
|
||||||
|
println(color)
|
||||||
assert num == 3
|
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().replace('\n\n\n', '\n').trim_space()
|
||||||
//s := p.scanner.fmt_out.str().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')
|
s := p.scanner.fmt_lines.join('').trim_space().replace_each([
|
||||||
.replace(' \n', '\n')
|
'\n\n\n\n', '\n\n',
|
||||||
|
' \n', '\n',
|
||||||
|
') or{', ') or {',
|
||||||
|
])
|
||||||
if s == '' {
|
if s == '' {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user