Skip to content

Commit

Permalink
Update baseline tests for java checker:
Browse files Browse the repository at this point in the history
- use unique overload_ids
- fix file with typo

PiperOrigin-RevId: 686195856
jnthntatum authored and copybara-github committed Oct 15, 2024
1 parent 1021e70 commit 6dc2f16
Showing 5 changed files with 24 additions and 24 deletions.
18 changes: 9 additions & 9 deletions checker/src/test/java/dev/cel/checker/ExprCheckerTest.java
Original file line number Diff line number Diff line change
@@ -805,13 +805,13 @@ public void abstractTypeParameterized() throws Exception {
"vector",
// Declare the function 'vector' to create the abstract type.
globalOverload(
"vector",
"vector_type",
ImmutableList.of(CelTypes.create(typeParam)),
ImmutableList.of("T"),
CelTypes.create(abstractType)),
// Declare a function to create a new value of abstract type based on a list.
globalOverload(
"vector",
"vector_list",
ImmutableList.of(createList(typeParam)),
ImmutableList.of("T"),
abstractType));
@@ -820,7 +820,7 @@ public void abstractTypeParameterized() throws Exception {
declareFunction(
"at",
memberOverload(
"at",
"vector_at_int",
ImmutableList.of(abstractType, CelTypes.INT64),
ImmutableList.of("T"),
typeParam));
@@ -843,13 +843,13 @@ public void abstractTypeParameterizedInListLiteral() throws Exception {
"vector",
// Declare the function 'vector' to create the abstract type.
globalOverload(
"vector",
"vector_type",
ImmutableList.of(CelTypes.create(typeParam)),
ImmutableList.of("T"),
CelTypes.create(abstractType)),
// Declare a function to create a new value of abstract type based on a list.
globalOverload(
"vector",
"vector_list",
ImmutableList.of(createList(typeParam)),
ImmutableList.of("T"),
abstractType));
@@ -870,23 +870,23 @@ public void abstractTypeParameterizedError() throws Exception {
"vector",
// Declare the function 'vector' to create the abstract type.
globalOverload(
"vector",
"vector_type",
ImmutableList.of(CelTypes.create(typeParam)),
ImmutableList.of("T"),
CelTypes.create(abstractType)),
// Declare a function to create a new value of abstract type based on a list.
globalOverload(
"vector",
"vector_list",
ImmutableList.of(createList(typeParam)),
ImmutableList.of("T"),
abstractType));
declareFunction(
"add",
globalOverload(
"add",
"add_vector_type",
ImmutableList.of(CelTypes.create(abstractType), CelTypes.create(abstractType)),
ImmutableList.of("T"),
abstractType));
CelTypes.create(abstractType)));
source = "add(vector([1, 2]), vector([2u, -1])) == vector([1, 2, 2u, -1])";
runTest();
}
14 changes: 7 additions & 7 deletions checker/src/test/resources/abstractTypeParameterized.baseline
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Source: type(vector([1])) == vector(dyn) && vector([1]).at(0) == 1
declare vector {
function vector (type(T)) -> type(vector(T))
function vector (list(T)) -> vector(T)
function vector_type (type(T)) -> type(vector(T))
function vector_list (list(T)) -> vector(T)
}
declare at {
function at vector(T).(int) -> T
function vector_at_int vector(T).(int) -> T
}
=====>
_&&_(
@@ -14,20 +14,20 @@ _&&_(
[
1~int
]~list(int)
)~vector(int)^vector
)~vector(int)^vector_list
)~type(vector(int))^type,
vector(
dyn~type(dyn)^dyn
)~type(vector(dyn))^vector
)~type(vector(dyn))^vector_type
)~bool^equals,
_==_(
vector(
[
1~int
]~list(int)
)~vector(int)^vector.at(
)~vector(int)^vector_list.at(
0~int
)~int^at,
)~int^vector_at_int,
1~int
)~bool^equals
)~bool^logical_and
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Source: add(vector([1, 2]), vector([2u, -1])) == vector([1, 2, 2u, -1])
declare vector {
function vector (type(T)) -> type(vector(T))
function vector (list(T)) -> vector(T)
function vector_type (type(T)) -> type(vector(T))
function vector_list (list(T)) -> vector(T)
}
declare add {
function add (type(vector(T)), type(vector(T))) -> vector(T)
function add_vector_type (type(vector(T)), type(vector(T))) -> type(vector(T))
}
=====>
ERROR: test_location:1:4: found no matching overload for 'add' applied to '(vector(int), vector(dyn))' (candidates: (type(vector(%T4)), type(vector(%T4))))
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Source: size([vector([1, 2]), vector([2u, -1])]) == 2
declare vector {
function vector (type(T)) -> type(vector(T))
function vector (list(T)) -> vector(T)
function vector_type (type(T)) -> type(vector(T))
function vector_list (list(T)) -> vector(T)
}
=====>
_==_(
@@ -12,13 +12,13 @@ _==_(
1~int,
2~int
]~list(int)
)~vector(int)^vector,
)~vector(int)^vector_list,
vector(
[
2u~uint,
-1~int
]~list(dyn)
)~vector(dyn)^vector
)~vector(dyn)^vector_list
]~list(vector(dyn))
)~int^size_list,
2~int
2 changes: 1 addition & 1 deletion checker/src/test/resources/jsonStructTypeError.baseline
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ource: x["iss"] != TestAllTypes{single_int32: 1}
Source: x["iss"] != TestAllTypes{single_int32: 1}
declare x {
value google.protobuf.Struct
}

0 comments on commit 6dc2f16

Please sign in to comment.