mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 19:05:59 +01:00
fix inQuotes + tests
This commit is contained in:
@@ -49,6 +49,22 @@ describe("Lexer expression", () => {
|
||||
.toEqual(["#label", "*=*", "text"]);
|
||||
});
|
||||
|
||||
it("simple label operator with in quotes and without", () => {
|
||||
expect(lexer("#label*=*'text'").expressionTokens)
|
||||
.toEqual([
|
||||
{token: "#label", inQuotes: false},
|
||||
{token: "*=*", inQuotes: false},
|
||||
{token: "text", inQuotes: true}
|
||||
]);
|
||||
|
||||
expect(lexer("#label*=*text").expressionTokens)
|
||||
.toEqual([
|
||||
{token: "#label", inQuotes: false},
|
||||
{token: "*=*", inQuotes: false},
|
||||
{token: "text", inQuotes: false}
|
||||
]);
|
||||
});
|
||||
|
||||
it("complex expressions with and, or and parenthesis", () => {
|
||||
expect(lexer(`# (#label=text OR #second=text) AND ~relation`).expressionTokens.map(t => t.token))
|
||||
.toEqual(["#", "(", "#label", "=", "text", "or", "#second", "=", "text", ")", "and", "~relation"]);
|
||||
|
||||
Reference in New Issue
Block a user