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

test the recent type alias string; print vweb templates in verbose mode

This commit is contained in:
Alexander Medvednikov
2019-12-16 18:58:56 +03:00
parent 8c0e0f8ab7
commit bcde155da7
3 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,19 @@
struct Human { name string }
pub fn (h Human) str() string { return 'Human: $h.name' }
type Person Human
fn test_type_print() {
p := Person{'Bilbo'}
println(p)
assert p.str() == 'Human: Bilbo'
}
pub fn (h Person) str() string { return 'Person: $h.name' }
fn test_person_str() {
p := Person{'Bilbo'}
println(p)
assert p.str() == 'Person: Bilbo'
}