test enum printing

pull/3130/head
Alexander Medvednikov 2019-12-18 05:45:48 +03:00
parent 7456d556e1
commit 3d1db3519d
2 changed files with 14 additions and 8 deletions

View File

@ -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
} }

View File

@ -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
} }