Skip to content

Commit

Permalink
Test all possible duplications
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Sep 18, 2019
1 parent 562eb92 commit 4739f97
Show file tree
Hide file tree
Showing 141 changed files with 1,505 additions and 50 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
These tests have been generated using the following script:

```js
var feat = {
"field": "#x = 0;",
"method": "#x() {}",
"get": "get #x() {}",
"set": "set #x(_) {}",
};
var placement = {
"static": "static ",
"instance": ""
}

for (var f1 in feat) for (var f2 in feat) for (var p1 in placement) for (var p2 in placement) {
var code = `class A {
${placement[p1]}${feat[f1]}
${placement[p2]}${feat[f2]}
}`;
var name = `${p1}-${f1}-${p2}-${f2}`;
var options = `{
"plugins": ["classPrivateProperties", "classPrivateMethods"],
"throws": "Duplicate private name #x (3:${2 + placement[p2].length + feat[f2].indexOf("#")})"
}`
var folder = "packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/" + name;

if (!fs.existsSync(folder)) fs.mkdirSync(folder);
fs.writeFileSync(folder + "/input.js", code);
fs.writeFileSync(folder + "/options.json", options);
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class A {
#x = 0;
#x = 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"plugins": ["classPrivateProperties", "classPrivateMethods"],
"throws": "Duplicate private name #x (3:2)"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class A {
#x = 0;
get #x() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"plugins": ["classPrivateProperties", "classPrivateMethods"],
"throws": "Duplicate private name #x (3:6)"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class A {
#x = 0;
#x() {}
#x;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"plugins": ["classPrivateProperties", "classPrivateMethods"],
"throws": "Duplicate private name #x (3:2)"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class A {
#x = 0;
set #x(_) {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"plugins": ["classPrivateProperties", "classPrivateMethods"],
"throws": "Duplicate private name #x (3:6)"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class A {
#x = 0;
static #x = 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"plugins": ["classPrivateProperties", "classPrivateMethods"],
"throws": "Duplicate private name #x (3:9)"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class A {
#x = 0;
static get #x() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"plugins": ["classPrivateProperties", "classPrivateMethods"],
"throws": "Duplicate private name #x (3:13)"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class A {
#x = 0;
static #x() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"plugins": ["classPrivateProperties", "classPrivateMethods"],
"throws": "Duplicate private name #x (3:9)"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class A {
#x = 0;
static set #x(_) {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"plugins": ["classPrivateProperties", "classPrivateMethods"],
"throws": "Duplicate private name #x (3:13)"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class A {
get #x() {}
#x = 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"plugins": ["classPrivateProperties", "classPrivateMethods"],
"throws": "Duplicate private name #x (3:2)"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class A {
get #x() {}
get #x() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"plugins": ["classPrivateProperties", "classPrivateMethods"],
"throws": "Duplicate private name #x (3:6)"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"plugins": ["classPrivateProperties", "classPrivateMethods"],
"throws": "Duplicate private name #x (3:2)"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class A {
get #x() {}
set #x(_) {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"plugins": ["classPrivateProperties", "classPrivateMethods"]
}

0 comments on commit 4739f97

Please sign in to comment.