mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
24 lines
330 B
V
24 lines
330 B
V
type Map = map[string]string
|
|
|
|
pub fn new_map() Map {
|
|
return Map({
|
|
'23': 'str'
|
|
})
|
|
}
|
|
|
|
fn (a Map) + (b Map) Map {
|
|
str := b['23']
|
|
return Map({
|
|
'34': str + '12'
|
|
})
|
|
}
|
|
|
|
fn test_map_alias_op_overloading() {
|
|
a := new_map()
|
|
b := new_map()
|
|
assert a + b == Map({
|
|
'34': 'str12'
|
|
})
|
|
assert '${a + b}' == "Map({'34': 'str12'})"
|
|
}
|