MCPcopy
hub / github.com/google/mangle / TestRelTypeExprFromDecl

Function TestRelTypeExprFromDecl

symbols/symbols_test.go:216–235  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

214}
215
216func TestRelTypeExprFromDecl(t *testing.T) {
217 relTypeExpr, err := RelTypeExprFromDecl(ast.Decl{
218 ast.NewAtom("foo", ast.Variable{"X"}, ast.Variable{"Y"}),
219 nil,
220 []ast.BoundDecl{
221 ast.NewBoundDecl(ast.StringBound, ast.NumberBound),
222 ast.NewBoundDecl(ast.NumberBound, ast.StringBound),
223 },
224 nil,
225 })
226 if err != nil {
227 t.Fatal(err)
228 }
229 want := NewUnionType(
230 NewRelType(ast.StringBound, ast.NumberBound),
231 NewRelType(ast.NumberBound, ast.StringBound))
232 if !relTypeExpr.Equals(want) {
233 t.Errorf("%v.Equals(%v)=false want true", relTypeExpr, want)
234 }
235}
236
237func TestRelTypeMethods(t *testing.T) {
238 tests := []struct {

Callers

nothing calls this directly

Calls 6

NewAtomFunction · 0.92
NewBoundDeclFunction · 0.92
RelTypeExprFromDeclFunction · 0.85
NewUnionTypeFunction · 0.85
NewRelTypeFunction · 0.85
EqualsMethod · 0.65

Tested by

no test coverage detected