| 1 | interface Context { |
| 2 | str() string |
| 3 | } |
| 4 | |
| 5 | struct OtherContext { |
| 6 | a string |
| 7 | } |
| 8 | |
| 9 | pub fn (o &OtherContext) str() string { |
| 10 | return 'OtherContext' |
| 11 | } |
| 12 | |
| 13 | struct WithContext { |
| 14 | pub mut: |
| 15 | ctx Context |
| 16 | } |
| 17 | |
| 18 | fn with_function(ctx Context) { |
| 19 | println(ctx) |
| 20 | } |
| 21 | |
| 22 | fn test_main() { |
| 23 | mut s := WithContext{ |
| 24 | ctx: OtherContext{} |
| 25 | } |
| 26 | assert dump(s) == WithContext{ |
| 27 | ctx: OtherContext{} |
| 28 | } |
| 29 | |
| 30 | assert dump(OtherContext{}) == OtherContext{} |
| 31 | } |
| 32 |