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

21 lines
296 B
V

struct Foo {
bar int
}
fn (f &Foo) str() string {
return '${f.bar}'
}
struct Bar {
foo &Foo
}
fn test_interpolation_with_custom_ref_str() {
foo := Foo{}
bar := Bar{&foo}
println(bar)
assert '${bar}'.contains('Bar{')
assert '${bar}'.contains('foo: &0')
assert '${bar}'.contains('}')
}