Skip to content

Commit

Permalink
Add failing private flavour test
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Jan 27, 2024
1 parent f65117f commit be626bf
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 0 deletions.
@@ -0,0 +1,34 @@
var counter = 0;

class A {
@((_, { addInitializer }) => {
addInitializer(function () {
counter++;
expect(typeof this.method).toBe("function");
expect(this.#foo).toBe("#foo");
expect(() => this.#bar).toThrow();
});
})
#foo = (() => {
counter++;
expect(typeof this.method).toBe("function");
expect(() => this.#foo).toThrow();
expect(() => this.#bar).toThrow();
return "#foo";
})();

method() {}

#bar = (() => {
counter++;
expect(typeof this.method).toBe("function");
expect(this.#foo).toBe("#foo");
expect(() => this.#bar).toThrow();
})();
}

expect(counter).toBe(0);

new A();

expect(counter).toBe(3);
@@ -0,0 +1,34 @@
var counter = 0;

class A {
@((_, { addInitializer }) => {
addInitializer(function () {
counter++;
expect(typeof this.method).toBe("function");
expect(this.#foo).toBe("#foo");
expect(() => this.#bar).toThrow();
});
})
#foo = (() => {
counter++;
expect(typeof this.method).toBe("function");
expect(() => this.#foo).toThrow();
expect(() => this.#bar).toThrow();
return "#foo";
})();

method() {}

#bar = (() => {
counter++;
expect(typeof this.method).toBe("function");
expect(this.#foo).toBe("#foo");
expect(() => this.#bar).toThrow();
})();
}

expect(counter).toBe(0);

new A();

expect(counter).toBe(3);
@@ -0,0 +1,34 @@
var _dec, _init_foo, _init_extra_foo;
var counter = 0;
_dec = (_, {
addInitializer
}) => {
addInitializer(function () {
counter++;
expect(typeof this.method).toBe("function");
expect(this.#foo).toBe("#foo");
expect(() => this.#bar).toThrow();
});
};
class A {
static {
[_init_foo, _init_extra_foo] = babelHelpers.applyDecs2311(this, [[_dec, 0, "foo", o => o.#foo, (o, v) => o.#foo = v]], [], 0, _ => #bar in _).e;
}
#foo = _init_foo(this, (() => {
counter++;
expect(typeof this.method).toBe("function");
expect(() => this.#foo).toThrow();
expect(() => this.#bar).toThrow();
return "#foo";
})());
method() {}
#bar = (_init_extra_foo(this), (() => {
counter++;
expect(typeof this.method).toBe("function");
expect(this.#foo).toBe("#foo");
expect(() => this.#bar).toThrow();
})());
}
expect(counter).toBe(0);
new A();
expect(counter).toBe(3);

0 comments on commit be626bf

Please sign in to comment.