github.com/yunabe/lgo@v0.0.0-20190709125917-42c42d410fdf/parser/go1.9_test.go (about) 1 // Copyright 2009 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // This file contains test cases for type alias which is supported from go1.9. 6 // +build go1.9 7 8 package parser 9 10 import "testing" 11 12 var validTypeAliases = []string{ 13 `package p; type T = int`, 14 `package p; type (T = p.T; _ = struct{}; x = *T)`, 15 } 16 17 func TestValidTypeAlias(t *testing.T) { 18 for _, src := range validTypeAliases { 19 checkErrors(t, src, src) 20 } 21 } 22 23 func TestParseExprTypeAlias(t *testing.T) { 24 // ParseExpr must not crash 25 for _, src := range validTypeAliases { 26 ParseExpr(src) 27 } 28 }