[FIX] qweb: add missing not equals operators

Implement "!=" and "!==" operator support in QWeb.
This commit is contained in:
Pierre Paridans
2019-06-26 14:37:21 +02:00
committed by Géry Debongnie
parent ee63f6bb0f
commit e838e879c0
2 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -82,7 +82,7 @@ const STATIC_TOKEN_MAP: { [key: string]: TKind } = {
")": "RIGHT_PAREN" ")": "RIGHT_PAREN"
}; };
const OPERATORS = ".,===,==,+,!,||,&&,>=,>,<=,<,?,-,*,/,%".split(','); const OPERATORS = ".,===,==,+,!==,!=,!,||,&&,>=,>,<=,<,?,-,*,/,%".split(',');
type Tokenizer = (expr: string) => Token | false; type Tokenizer = (expr: string) => Token | false;
+3 -1
View File
@@ -40,11 +40,13 @@ describe("tokenizer", () => {
}); });
test("various operators", () => { test("various operators", () => {
expect(tokenize(">= <= < >")).toEqual([ expect(tokenize(">= <= < > !== !=")).toEqual([
{ type: "OPERATOR", value: ">=" }, { type: "OPERATOR", value: ">=" },
{ type: "OPERATOR", value: "<=" }, { type: "OPERATOR", value: "<=" },
{ type: "OPERATOR", value: "<" }, { type: "OPERATOR", value: "<" },
{ type: "OPERATOR", value: ">" }, { type: "OPERATOR", value: ">" },
{ type: "OPERATOR", value: "!==" },
{ type: "OPERATOR", value: "!=" },
]); ]);
}); });