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

Function TestBoundsCheckingPositive

analysis/declcheck_test.go:48–77  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

46}
47
48func TestBoundsCheckingPositive(t *testing.T) {
49 tests := []struct {
50 name string
51 boundDecl ast.BoundDecl
52 }{
53 {
54 name: "simple arguments",
55 boundDecl: ast.NewBoundDecl(ast.NameBound, ast.NumberBound),
56 },
57 {
58 name: "proper type expressions",
59 boundDecl: ast.NewBoundDecl(
60 ast.ApplyFn{symbols.ListType, []ast.BaseTerm{ast.NumberBound}},
61 ast.ApplyFn{symbols.PairType, []ast.BaseTerm{ast.NumberBound, ast.StringBound}}),
62 },
63 {
64 name: "union type expressions",
65 boundDecl: ast.NewBoundDecl(
66 ast.ApplyFn{symbols.UnionType, []ast.BaseTerm{ast.NameBound, ast.NumberBound}},
67 ast.ApplyFn{symbols.UnionType, []ast.BaseTerm{ast.NumberBound, ast.StringBound}}),
68 },
69 }
70 for _, test := range tests {
71 t.Run(test.name, func(t *testing.T) {
72 if errs := checkBoundDecl(test.boundDecl); errs != nil {
73 t.Error(errs[0])
74 }
75 })
76 }
77}
78
79func TestCheckDeclExternal(t *testing.T) {
80 testCases := []struct {

Callers

nothing calls this directly

Calls 3

NewBoundDeclFunction · 0.92
checkBoundDeclFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected