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