func TestCompile(t *testing.T) {
	return  
	code, _ := translateSymbols(testCode)
	err := ioutil.WriteFile("/tmp/testcode.go", code, 0666)
	if err != nil {
		t.Errorf("write file failed: %v", err)
	}
}
TestCompile writes the test code to /tmp/testcode.go so
that it can be verified that it actually compiles.
package types
import (
	"bytes"
	"flag"
	"io/ioutil"
	"os"
	"path/filepath"
	"strings"
	"testing"
	"unicode"
	"github.com/rogpeppe/godef/go/ast"
	"github.com/rogpeppe/godef/go/parser"
	"github.com/rogpeppe/godef/go/token"
)
var testStdlib = flag.Bool("test-stdlib", false, "test all symbols in standard library (will fail)")
type astVisitor func(n ast.Node) bool
func (f astVisitor) Visit(n ast.Node) ast.Visitor {
	if f(n) {
		return f
	}
	return nil
}
func parseDir(dir string) *ast.Package {
	pkgs, _ := parser.ParseDir(FileSet, dir, isGoFile, 0, DefaultImportPathToName)
	if len(pkgs) == 0 {
		return nil
	}
	delete(pkgs, "documentation")
	for name, pkg := range pkgs {
		if len(pkgs) == 1 || name != "main" {
			return pkg
		}
	}
	return nil
}
func checkExprs(t *testing.T, pkg *ast.File, importer Importer, fset *token.FileSet) {
	var visit astVisitor
	stopped := false
	visit = func(n ast.Node) bool {
		if stopped {
			return false
		}
		mustResolve := false
		var e ast.Expr
		switch n := n.(type) {
		case *ast.ImportSpec:
			if n.Name != nil && n.Name.Name == "." {
				stopped = true
				return false
			}
			return true
		case *ast.FuncDecl:
			if n.Recv == nil && n.Name.Name == "init" {
				n.Name.Obj = ast.NewObj(ast.Fun, "init")
			}
			return true
		case *ast.Ident:
			if n.Name == "_" {
				return false
			}
			e = n
			mustResolve = true
		case *ast.KeyValueExpr:
			ast.Walk(visit, n.Value)
			return false
		case *ast.SelectorExpr:
			ast.Walk(visit, n.X)
			e = n
			mustResolve = true
		case *ast.File:
			for _, d := range n.Decls {
				ast.Walk(visit, d)
			}
			return false
		case ast.Expr:
			e = n
		default:
			return true
		}
		defer func() {
			if err := recover(); err != nil {
				t.Fatalf("panic (%v) on %T", err, e)
			}
		}()
		obj, _ := ExprType(e, importer, fset)
		if obj == nil && mustResolve {
			t.Errorf("no object for %v(%p, %T) at %v\n", e, e, e, FileSet.Position(e.Pos()))
		}
		return false
	}
	ast.Walk(visit, pkg)
}
func TestStdLib(t *testing.T) {
	if !*testStdlib {
		t.SkipNow()
	}
	Panic = false
	defer func() {
		Panic = true
	}()
	root := os.Getenv("GOROOT") + "/src"
	cache := make(map[string]*ast.Package)
	importer := func(path, srcDir string) *ast.Package {
		p := filepath.Join(root, "pkg", path)
		if pkg := cache[p]; pkg != nil {
			return pkg
		}
		pkg := DefaultImporter(path, srcDir)
		cache[p] = pkg
		return pkg
	}
	visit := func(path string, f os.FileInfo, err error) error {
		if err != nil {
			return err
		}
		if !f.IsDir() {
			return nil
		}
		pkg := cache[path]
		if pkg == nil {
			pkg = parseDir(path)
		}
		if pkg != nil {
			for _, f := range pkg.Files {
				checkExprs(t, f, importer, FileSet)
			}
		}
		return nil
	}
	filepath.Walk(root, visit)
}