Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
buildbreaker committed Jul 5, 2023
1 parent 5e11500 commit cf64ebd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1222,8 +1222,6 @@ static Val refResolve(TypeAdapter adapter, Val idx, Object obj) {
if (idx.type() == IntT.IntType) {
// Assume idx is an integer type.
return lister.get(idx);
} else {
return noSuchOverload(celVal, "lister-get", null);
}
}
if (celVal instanceof Indexer) {
Expand Down
38 changes: 0 additions & 38 deletions core/src/test/java/org/projectnessie/ListContainsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,44 +28,6 @@
import org.projectnessie.cel.tools.ScriptHost;

public class ListContainsTest {
@Test
public void listTypeResolutionFieldLookupSuccess() throws ScriptException {
ScriptHost scriptHost = ScriptHost.newBuilder().build();
Script script =
scriptHost
.buildScript("!(this in dyn(rules)['in']) ? 'value must be in list' : ''")
.withDeclarations(
Decls.newVar("this", Decls.String),
Decls.newVar("rules", Decls.newListType(Decls.String)))
.build();

Map<String, Object> arguments = new HashMap<>();
arguments.put("this", "hello");
arguments.put("rules", new String[] {"hello", "world"});

String result = script.execute(String.class, arguments);
assertThat(result).isEqualTo("");
}

@Test
public void listTypeResolutionFieldLookupFailure() throws ScriptException {
ScriptHost scriptHost = ScriptHost.newBuilder().build();
Script script =
scriptHost
.buildScript("!(this in dyn(rules)['in']) ? 'value must be in list' : ''")
.withDeclarations(
Decls.newVar("this", Decls.String),
Decls.newVar("rules", Decls.newListType(Decls.String)))
.build();

Map<String, Object> arguments = new HashMap<>();
arguments.put("this", "nothello");
arguments.put("rules", new String[] {"hello", "world"});

String result = script.execute(String.class, arguments);
assertThat(result).isEqualTo("value must be in list");
}

@Test
public void dynamicProtobufFieldLookupSuccess() throws ScriptException {
UnknownSet rule = UnknownSet.newBuilder().addExprs(1).addExprs(2).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ static GetFromTestCase[] getFromTestCases() {
Struct.newBuilder()
.putFields("null", Value.newBuilder().setNullValue(NullValue.NULL_VALUE).build())
.build()),
new GetFromTestCase().field("repeated_uint32").want(Arrays.asList(1, 2, 3)),
new GetFromTestCase()
.field("repeated_uint32")
.want(Arrays.asList(ULong.valueOf(1L), ULong.valueOf(2L), ULong.valueOf(3L))),
};
}

Expand Down

0 comments on commit cf64ebd

Please sign in to comment.