83
|
1 //===- string_test.go - test Stringer implementation for Type -------------===//
|
|
2 //
|
|
3 // The LLVM Compiler Infrastructure
|
|
4 //
|
|
5 // This file is distributed under the University of Illinois Open Source
|
|
6 // License. See LICENSE.TXT for details.
|
|
7 //
|
|
8 //===----------------------------------------------------------------------===//
|
|
9 //
|
|
10 // This file tests the Stringer interface for the Type type.
|
|
11 //
|
|
12 //===----------------------------------------------------------------------===//
|
|
13
|
|
14 package llvm
|
|
15
|
|
16 import (
|
|
17 "testing"
|
|
18 )
|
|
19
|
|
20 func TestStringRecursiveType(t *testing.T) {
|
|
21 ctx := NewContext()
|
|
22 defer ctx.Dispose()
|
|
23 s := ctx.StructCreateNamed("recursive")
|
|
24 s.StructSetBody([]Type{s, s}, false)
|
|
25 if str := s.String(); str != "%recursive: StructType(%recursive, %recursive)" {
|
|
26 t.Errorf("incorrect string result %q", str)
|
|
27 }
|
|
28 }
|