(t *testing.T)
| 11 | ) |
| 12 | |
| 13 | func TestModuleString(t *testing.T) { |
| 14 | golden := []struct { |
| 15 | in *Module |
| 16 | want string |
| 17 | }{ |
| 18 | // Empty module. |
| 19 | { |
| 20 | in: &Module{}, |
| 21 | want: "", |
| 22 | }, |
| 23 | // Type definition. |
| 24 | { |
| 25 | in: &Module{ |
| 26 | TypeDefs: []types.Type{&types.StructType{ |
| 27 | TypeName: "foo", |
| 28 | Fields: []types.Type{types.I32}, |
| 29 | }}, |
| 30 | }, |
| 31 | want: "%foo = type { i32 }", |
| 32 | }, |
| 33 | } |
| 34 | for _, g := range golden { |
| 35 | got := strings.TrimSpace(g.in.String()) |
| 36 | if g.want != got { |
| 37 | t.Errorf("module mismatch; expected `%v`, got `%v`", g.want, got) |
| 38 | } |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | // Assert that each constant implements the constant.Constant interface. |
| 43 | var ( |
nothing calls this directly
no test coverage detected
searching dependent graphs…