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:
19
vlib/compiler/tests/type_test.v
Normal file
19
vlib/compiler/tests/type_test.v
Normal 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'
|
||||
}
|
Reference in New Issue
Block a user