Skip to content

Commit

Permalink
Added tests for tokenizePart util
Browse files Browse the repository at this point in the history
  • Loading branch information
JawHawk committed Mar 19, 2024
1 parent ed093fb commit 469a50c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions benchexec/tablegenerator/react-table/src/tests/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
makeFilterDeserializer,
splitUrlPathForMatchingPrefix,
makeRegExp,
tokenizePart,
} from "../utils/utils";

describe("isStatusOk", () => {
Expand Down Expand Up @@ -271,6 +272,20 @@ describe("decodeFilter", () => {
});
});

describe("tokenizePart", () => {
test("should tokenizePart to get Filter keys", () => {
const string = "id_any(value(%29)),0(1*cputime*(value(2)))";
const expected = { 0: "1*cputime*(value(2))", id_any: "value(%29)" };
expect(tokenizePart(string)).toEqual(expected);
});

test("should tokenizePart to get Filter values", () => {
const string = "value(%29)";
const expected = { value: ")" };
expect(tokenizePart(string, true)).toEqual(expected);
});
});

describe("serialization", () => {
let serializer;
const statusValues = [
Expand Down
2 changes: 1 addition & 1 deletion benchexec/tablegenerator/react-table/src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ const makeFilterSerializer =
return filterString;
};

const tokenizePart = (string, decodeValue = false) => {
export const tokenizePart = (string, decodeValue = false) => {
const out = {};
let openBrackets = 0;

Expand Down

0 comments on commit 469a50c

Please sign in to comment.