Пример #1
0
func (suite *ImportTestSuite) TestDetectFreeVariable() {
	ls := types.MakeStructType("Local", []types.Field{
		types.Field{"b", types.MakePrimitiveType(types.BoolKind), false},
		types.Field{"n", types.MakeUnresolvedType("", "OtherLocal"), false},
	},
		types.Choices{})
	suite.Panics(func() {
		inter := intermediate{Types: []types.Type{ls}}
		resolveLocalOrdinals(&inter)
	})
}
Пример #2
0
func (suite *ImportTestSuite) TestUnknownAlias() {
	deps := getDeps([]ref.Ref{suite.importRef}, suite.vrw)
	suite.Panics(func() {
		resolveNamespace(types.MakeUnresolvedType("Bother", "ForeignEnum"), map[string]ref.Ref{"Other": suite.importRef}, deps)
	})
}
Пример #3
0
func (suite *ImportTestSuite) TestUnknownImportedType() {
	deps := getDeps([]ref.Ref{suite.importRef}, suite.vrw)
	suite.Panics(func() {
		resolveNamespace(types.MakeUnresolvedType("Other", "NotThere"), map[string]ref.Ref{"Other": suite.importRef}, deps)
	})
}
Пример #4
0
func (suite *ImportTestSuite) TestResolveNamespace() {
	deps := getDeps([]ref.Ref{suite.importRef}, suite.vrw)
	t := resolveNamespace(types.MakeUnresolvedType("Other", "ForeignEnum"), map[string]ref.Ref{"Other": suite.importRef}, deps)
	suite.EqualValues(types.MakeType(suite.importRef, 1), t)
}