| 1 | interface Interface { |
| 2 | str() string |
| 3 | } |
| 4 | |
| 5 | struct Result[T] { |
| 6 | data []T |
| 7 | } |
| 8 | |
| 9 | struct Foobar { |
| 10 | } |
| 11 | |
| 12 | fn (f Foobar) str() string { |
| 13 | return 'foobar' |
| 14 | } |
| 15 | |
| 16 | fn test_main() { |
| 17 | assert Result[Interface]{}.str() == 'Result[Interface]{ |
| 18 | data: [] |
| 19 | }' |
| 20 | assert Result[Foobar]{ |
| 21 | data: [Foobar{}] |
| 22 | }.str() == 'Result[Foobar]{ |
| 23 | data: [foobar] |
| 24 | }' |
| 25 | } |
| 26 |