| 1 | import v.ast |
| 2 | import v.parser |
| 3 | import v.pref |
| 4 | |
| 5 | fn test_typed_map_init_is_rejected_in_fmt_mode() { |
| 6 | source_text := 'module main |
| 7 | |
| 8 | const c_cap = 10 |
| 9 | |
| 10 | fn main() { |
| 11 | _ := map[string][]u8{cap: c_cap} |
| 12 | } |
| 13 | ' |
| 14 | mut table := ast.new_table() |
| 15 | prefs := &pref.Preferences{ |
| 16 | is_fmt: true |
| 17 | output_mode: .silent |
| 18 | } |
| 19 | prog := parser.parse_text(source_text, '', mut table, .skip_comments, prefs) |
| 20 | assert prog.errors.any(it.message == '`}` expected; explicit `map` initialization does not support parameters') |
| 21 | } |
| 22 | |