(t *testing.T)
| 1292 | } |
| 1293 | |
| 1294 | func TestVariableDeclToExprDecl(t *testing.T) { |
| 1295 | a, err := VariableDeclToExprDecl(NewVariable("a", types.BoolType)) |
| 1296 | if err != nil { |
| 1297 | t.Fatalf("VariableDeclToExprDecl() failed: %v", err) |
| 1298 | } |
| 1299 | if !proto.Equal(a, chkdecls.NewVar("a", chkdecls.Bool)) { |
| 1300 | t.Error("proto.Equal() returned false, wanted true") |
| 1301 | } |
| 1302 | |
| 1303 | docVar := NewVariableWithDoc("a", types.BoolType, "doc") |
| 1304 | a, err = VariableDeclToExprDecl(docVar) |
| 1305 | if err != nil { |
| 1306 | t.Fatalf("VariableDeclToExprDecl() failed: %v", err) |
| 1307 | } |
| 1308 | if docVar.Description() != a.GetIdent().GetDoc() { |
| 1309 | t.Errorf("docVar.Description() got %s, wanted %s", docVar.Description(), a.GetIdent().GetDoc()) |
| 1310 | } |
| 1311 | if !proto.Equal(a, chkdecls.NewVarWithDoc("a", chkdecls.Bool, "doc")) { |
| 1312 | t.Error("proto.Equal() returned false, wanted true") |
| 1313 | } |
| 1314 | } |
| 1315 | |
| 1316 | func TestVariableDeclToExprDeclInvalid(t *testing.T) { |
| 1317 | out, err := VariableDeclToExprDecl(NewVariable("bad", &types.Type{})) |
nothing calls this directly
no test coverage detected