add more test cases

This commit is contained in:
Ivan Kopeykin 2024-04-12 11:13:27 +03:00
parent ccfdda11a8
commit e844cd3f27
3 changed files with 21 additions and 0 deletions

View File

@ -9,8 +9,13 @@
* @template T
*/
class AppendOnlyStackedSet {
/**
* @param {Array<Set<T>>} sets an optional array of sets
*/
constructor(sets = []) {
/** @type {Array<Set<T>>} */
this._sets = sets;
/** @type {Set<T>|undefined} */
this._current = undefined;
}
@ -41,6 +46,9 @@ class AppendOnlyStackedSet {
if (this._current) this._current.clear();
}
/**
* @returns {AppendOnlyStackedSet} child
*/
createChild() {
return new AppendOnlyStackedSet(
this._sets.length ? this._sets.slice() : []

View File

@ -60,6 +60,15 @@ describe("should not add additional warnings/errors", () => {
if (`${a}`) {}
});
it("ternary operator", () => {
(c && c.a ? c.a() : 0);
const b1 = c ? c() : 0;
(c && c.a && d && d.a ? c.a(d.a) : 0);
("a" in c ? c.a() : 0);
("a" in c && "a" in b ? b.a(c.a) : 0);
(c ? d() : (() => {})());
});
it("in operator", () => {
if ("a" in m) { justFunction(m.a); }
if ("b" in m && "c" in m.b) { justFunction(m.b.c); }

View File

@ -59,6 +59,10 @@ module.exports = [
moduleName: /index/,
message: /d.+not found/
},
{
moduleName: /index/,
message: /d.+not found/
},
{
moduleName: /index/,
message: /c.+not found/