mirror of https://github.com/webpack/webpack.git
add more test cases
This commit is contained in:
parent
ccfdda11a8
commit
e844cd3f27
|
@ -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() : []
|
||||
|
|
|
@ -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); }
|
||||
|
|
|
@ -59,6 +59,10 @@ module.exports = [
|
|||
moduleName: /index/,
|
||||
message: /d.+not found/
|
||||
},
|
||||
{
|
||||
moduleName: /index/,
|
||||
message: /d.+not found/
|
||||
},
|
||||
{
|
||||
moduleName: /index/,
|
||||
message: /c.+not found/
|
||||
|
|
Loading…
Reference in New Issue